[Gambas-user] TextBox and CR

Caveat Gambas at ...1950...
Tue Apr 20 14:44:12 CEST 2010


Hi Rolf,
I guess you're right.  I threw the code together very quickly, just to
make a working example for you.  But 100% correct, you don't need lcode
or AS Variant or DIM or lcode = Key.Code... :-)

Let's just hope this doesn't turn into another marathon "static const?"
thread ;-)

Regards,
Caveat

On Tue, 2010-04-20 at 11:39 +0200, Rolf-Werner Eilert wrote:
> Great, thanks!
> 
> I just wonder why you load Key.Code into a variable before examining it 
> - isn't Key.Code a "variable" itself? (Or is it a function, and you 
> wanted to avoid calling it more than once?)
> 
> Rolf
> 
> 
> Am 20.04.2010 10:58, schrieb Caveat:
> > Hi Rolf
> >
> > You could try this:
> > PUBLIC SUB TextBox1_KeyPress()
> >
> >    DIM lcode AS Variant
> >    lcode = Key.Code
> >
> >
> >    IF NOT IsNull(lcode) THEN
> >      IF lcode = Key.Enter OR lcode = Key.Return THEN
> >        Message.Info("Go SEARCH buddy!")
> >      END IF
> >    END IF
> >
> >
> > END
> >
> > Regards,
> > Caveat
> >
> > On Tue, 2010-04-20 at 09:42 +0200, Rolf-Werner Eilert wrote:
> >> Good morning everyone!
> >>
> >> In one of my programs there is a TextBox enabling the user to type in a
> >> search word. The TextBox seems to ignore a Return at the end, so I chose
> >> a "?" at the end of the string to indicate "go and search".
> >>
> >> It's a bit roundabout, however, isn't there a way to tell TextBox to
> >> include a CR in the string when Return is pressed?
> >>
> >> This is the code now ("Suche" means "Search"):
> >>
> >> PUBLIC SUB Suche_Change()
> >>
> >>
> >>     IF trim(Suche.Text) = "" THEN RETURN
> >>
> >>     IF String.Right(Suche.Text, 1)<>  "?" THEN RETURN
> >>
> >>     SucheStarten(Suche.Text)
> >>
> >> END
> >>
> >> Any easy way to make this react to a CR?
> >>
> >> Thanks for your ideas!
> >>
> >> Rolf
> >>
> >> ------------------------------------------------------------------------------
> >> Download Intel® Parallel Studio Eval
> >> Try the new software tools for yourself. Speed compiling, find bugs
> >> proactively, and fine-tune applications for parallel performance.
> >> See why Intel Parallel Studio got high marks during beta.
> >> http://p.sf.net/sfu/intel-sw-dev
> >> _______________________________________________
> >> Gambas-user mailing list
> >> Gambas-user at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Download Intel® Parallel Studio Eval
> > Try the new software tools for yourself. Speed compiling, find bugs
> > proactively, and fine-tune applications for parallel performance.
> > See why Intel Parallel Studio got high marks during beta.
> > http://p.sf.net/sfu/intel-sw-dev
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> 
> 
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list