Is it an accepted default for the cursor to be on the right side of the text if a textbox receives focus with the keyboard (through 'tabbing')?
Either that or highlighting the text seems to me to be the best default.
I know I can
SendMessage_(GadgetID(TheGadgetID), #EM_SETSEL, stringLen, stringLen)
...but when you're faced with adding that for every single stringgadget it becomes a lot of work.
Doesn't the right-cursor or auto-highlight make sense as the default?
Default Cursor Position In StringGadget
Default Cursor Position In StringGadget
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
With this snippet you can write once and it will handle every string gadget in your app:
I'm not 100% certain but I believe the StringGadget is the only PB gadget that handles the #PB_EventType_Focus, which would simplify things a bit.
Code: Select all
Select EventType()
;
; Other event stuff...
;
Case #PB_EventType_Focus
cls$ = Space(50)
GetClassName_(GadgetID(EventGadget()), @cls$, 50)
If UCase(cls$) = "EDIT"
length = Len(GetGadgetText(EventGadget()))
SendMessage_(GadgetID(EventGadget()), #EM_SETSEL, length, length)
EndIf
;
; More event stuff...
;BERESHEIT
Nice!
Thanks guys!
Thanks guys!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Thank you. This has helped me a lot. I use this code and it works. Also if you put 0 as the starting text and -1 at the end, it will select all text.
Code: Select all
objeto = EventGadget()
Select EventType()
Case #PB_EventType_Focus
If GadgetType(objeto) = #PB_GadgetType_String
SendMessage_(GadgetID(objeto), #EM_SETSEL, 0, -1)
EndIf
EndSelect Great stuff - thanks again!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Re: Default Cursor Position In StringGadget
> Is it an accepted default for the cursor to be on the right side of the text if
> a textbox receives focus with the keyboard (through 'tabbing')?
Depends on the locale. Arabic would have the cursor at the left.
> a textbox receives focus with the keyboard (through 'tabbing')?
Depends on the locale. Arabic would have the cursor at the left.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
