[Gambas-user] prb:Left() does not work correct.
ron
ronstk at ...239...
Mon Apr 24 06:04:33 CEST 2006
On Monday 24 April 2006 00:39, Benoit Minisini wrote:
> On Sunday 23 April 2006 23:29, ron wrote:
> > 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?
> >
> >
>
> I cannot reproduce your bug. Can you try with 1.9.29 ?
>
> Regards,
>
Just the same problem ATM.
The function Init is in a class file and called from the
main form sub _new()
Found something.
when I place only 3 textbox controls on the form it works
adding some other as button, labels and listbox, is still works
selecting the 3 working textbox, do cut and past so they are not
the *first* controls checked for tag it does not work any more
select all other, do cut and past and it works again.
Look to me as the first tag is null/empty or not used it does not work.
Test done by remove the first tag, not working, add the tag and it works.
This must be a bug somewhere, I do not see the logic of it.
Ron
More information about the User
mailing list