[Gambas-user] prb:Left() does not work correct.

ron ronstk at ...239...
Sun Apr 23 23:29:16 CEST 2006


gb2-1.9.28

In the tag of some controls on my form is a string as
"bind:fld=mykey"

PUBLIC FUNCTION Init(parent AS Form) AS Boolean
DIM idx AS Integer
DIM frm AS Form
DIM ctrl AS Control

  frm = parent
  FOR EACH ctrl IN frm.Children
    PRINT ctrl.Tag 'shows correct tag message
    PRINT Left(ctrl.tag, 4) 'gets the required text
    IF Left(ctrl.tag, 4) = "bind" THEN ' <-- skips 
      checktag(ctrl)  ' <---never called 
    END IF  
  NEXT
END

PUBLIC FUNCTION Init(parent AS Form) AS Boolean
DIM idx AS Integer
DIM frm AS Form
DIM ctrl AS Control
DIM t AS String

  frm = parent
  FOR EACH ctrl IN frm.Children
    PRINT ctrl.Tag
    t = Left(ctrl.tag, 4)
    PRINT t
    IF t = "bind" THEN ' works
      checktag(ctrl)  ' <-- is now done
    END IF  
  NEXT
END

As far I know should Left(ctrl.tag, 4) return a string type.
Change to Left$(ctrl.tag, 4) also did not work
After a try with second code block that did work I try 
with Cstr(Left$(ctrl.tag, 4)) and it works.

I asume mid() left() and right() shouls give me a string?
Using the left$() even did not. Something wrong here?







More information about the User mailing list