[Gambas-user] Create and delete labels dinamically

Charlie Reinl Karl.Reinl at ...2345...
Mon Jun 27 23:10:46 CEST 2011


Am Montag, den 27.06.2011, 22:31 +0200 schrieb M. Cs.:
> Thanks! I wonder whether it is possible with any kind of controls to
> do the same thing?
> 
> 2011/6/27, Caveat <Gambas at ...1950...>:
> >
> 

Salut,

yes you can, but that's not all.

CONST myGotFocusColor AS Integer = &HAAFF7F&
CONST myLostFocusColor AS Integer = &HF9F9BD&

PUBLIC SUB SetEditColor(oObj AS Object, objLast AS Control)
DIM myControl AS String
DIM hClass AS Control
DIM hCont AS Container
    myControl = Object.Class(objLast)
    FOR EACH hClass IN oObj.Children
      ' is it like my LAST ?
      IF Object.Class(hClass) = myControl THEN
        ' only for debugging
        'PRINT  Object.Class(hClass) & "     LAST.TAG = " & objLast.Tag
& "          hClass.Tag = "  & hClass.Tag
        IF objLast.Tag = hClass.Tag THEN
            hClass.Background = myGotFocusColor
        ELSE
            hClass.Background = myLostFocusColor
        ENDIF
      ELSE
        ' TRY if it is a Container
        TRY hCont = hClass
        IF NOT ERROR THEN
            ' I call my self to find out if there are Cildren like my
LAST
            SetEditColor(hClass, objLast)
        ENDIF
      ENDIF
    NEXT
END

to call like that SetEditColor(ME, LAST)

Where ME can be a form or a container, and LAST a control. Mainly evoked
by LAST!


-- 
Amicalement
Charlie

PS that is gambas2 code





More information about the User mailing list