[Gambas-user] Gambas IDE FOptions.class
R.Hansen
r.hansen at ...79...
Thu Feb 27 17:16:30 CET 2003
Thanks Benoît
my first approach was the same...
but never changed a color... now i realize my mistake... i observed the
compiled editor-frame the first time :-))). Of course, there can't
change any color :-)))
Regards,
Ralf
Am Don, 2003-02-27 um 15.58 schrieb Benoît Minisini:
> Le Jeudi 27 Février 2003 12:16, R.Hansen a écrit :
> > at the first, Thanks to Benoit!! Really a nice work.
> >
> > I found a trivial eror in the gambas ide: I like my own editor colors
> >
> > :-)) but if i changed any color, gambas crashed. The problem was
> >
> > SetColor(Last, Dialog.Color). At this time it looks that LAST is not the
> > Label but a Timer or an other Control,
> >
> > I have changed the code in the FOptions.class as followed:
> >
> > PUBLIC SUB lblColor_MouseUp(X AS Integer, Y AS Integer, Button AS
> > Integer)
> > ' ** start RH
> > DIM hCtrl AS Control
> > DIM iIndex AS Integer
> > iIndex = LAST.Tag
> > ' ** end RH
> >
> > LAST.Border = Border.Raised
> >
> > IF X >= 0 AND Y >= 0 AND X < LAST.W AND Y < LAST.H THEN
> >
> > Dialog.Color = LAST.Background
> > IF Dialog.SelectColor() THEN RETURN
> >
> > ' ** start RH
> >
> > FOR EACH hCtrl IN svwColor.Children
> >
> > IF hCtrl.Tag = iIndex THEN
> > SetColor(hCtrl, Dialog.Color, TRUE)
> > ENDIF
> >
> > NEXT
> >
> > 'SetColor(Last, Dialog.Color)
> >
> > ' ** end rh
> >
> > ENDIF
> >
> > END
> >
> > It's working but in my oppinion it must give another way without FOR
> > EACH.
> > How can i address the Label directly?
> >
> > svwColor.Children(iIndex) dont work
> > svwColor.lblColor(iIndex) dont work
> > lblColor(iIndex) dont work
> >
> > What is my error in reasoning??
> >
> > Regards,
> >
>
> Hi M. Hansen,
>
> You are right, this is a bug. The problem was the use of the LAST instruction
> just before a call to Dialog.SelectColor().
>
> The LAST instruction is valid until a call to the event loop... And during the
> color dialog call, the Timer used for animating the mascot wakes up, and
> modifies the value of LAST !
>
> So the fix is to simply put LAST into a local variable at the beginning of the
> event handler, and to use it, instead of using LAST each time.
>
> It is not necessary to use the Tag property to identify the control as you
> did. A direct reference is sufficient.
>
> Here is the result:
>
> -------
> PUBLIC SUB lblColor_MouseUp(X AS Integer, Y AS Integer, Button AS Integer)
>
> DIM hCtrl AS Label
>
> hCtrl = LAST
>
> hCtrl.Border = Border.Raised
>
> IF X >= 0 AND Y >= 0 AND X < hCtrl.W AND Y < hCtrl.H THEN
>
> Dialog.Color = hCtrl.Background
> IF Dialog.SelectColor() THEN RETURN
> SetColor(hCtrl, Dialog.Color)
>
> ENDIF
>
> END
> -------
>
> Regards,
>
> --
> Benoît Minisini
> mailto:gambas at ...1...
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
--
Ralf Hansen
Systems Engineer
Tembit Software GmbH
Am Borsigturm 42, 13507 Berlin
Fon: +49 30 4303 3282, Fax: +49 30 4303 3122
mailto: hansen at ...81..., http://www.tembit.de
More information about the User
mailing list