String Gadget ++

Just starting out? Need help? Post your questions and find answers here.
stan
User
User
Posts: 29
Joined: Tue Jun 10, 2003 2:46 pm

String Gadget ++

Post by stan »

Hi,

I use a stringgadget as an input for numbers, it displays only two digits, but if I use getgadgettext I can obtain a much longer string ... is there a way to retrieve only what is shown on the screen ?

The documentation mentions :

AdvancedGadgetEvents(#switch)

This command must be called before the gadget is created and the state can be changed between creating gadgets. For a list of supported events, look at the help page for the corresponding gadget.

I looked at the other gadgets and saw no mention of these Advanced Events ... Any help ?

TIA.

Bests.

Stan.
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

Post by TeddyLM »

Hi Stan,

i'm not sure i understand what you mean... you have a StringGadget that is 2 digits wide and with the 'GetGadgetText' command you get more than 2 ! You probably entered more than 2 characters ... Your StringGadget displays only the 2 last one but contain the whole text !

You can force your StringGadget to be only 2 characters wide by using this :

;for example
StringGadget(99, 100, 100, 100 , 24, "")
SendMessage_(GadgetID(99), #TCM_SETITEMSIZE , 0, 10)
;The StringGadget will accept only 10 Characters

hope i could help
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

Post by TeddyLM »

8O Oups sorry .... wrong code

hier it is :

SendMessage_(GadgetID(99), #EM_LIMITTEXT, 10, 0)

i definitively need some rest !! :lol:
stan
User
User
Posts: 29
Joined: Tue Jun 10, 2003 2:46 pm

Post by stan »

Hi TeddyLM,
i'm not sure i understand what you mean... you have a StringGadget that is 2 digits wide and with the 'GetGadgetText' command you get more than 2 ! You probably entered more than 2 characters ... Your StringGadget displays only the 2 last one but contain the whole text !

You can force your StringGadget to be only 2 characters wide by using this :

;for example
StringGadget(99, 100, 100, 100 , 24, "")
SendMessage_(GadgetID(99), #TCM_SETITEMSIZE , 0, 10)
;The StringGadget will accept only 10 Characters
This is exactly what I meant, even if my stringgadget is 2 characters wide I can type in more characters, I tried your solution unfortunately it doesn't work for me (using WIN98 SE), unless I missed something ...

Bests.

Stan.
stan
User
User
Posts: 29
Joined: Tue Jun 10, 2003 2:46 pm

Post by stan »

Hi TeddyLM,
SendMessage_(GadgetID(99), #EM_LIMITTEXT, 10, 0)
Now it works perfectly !!!

Many thanks !!! (Merci Beaucoup !!! )

Bests.

Stan.
Post Reply