[SOLVED] String Gadget Text Select Not Working

Just starting out? Need help? Post your questions and find answers here.
User avatar
Nexus100
User
User
Posts: 55
Joined: Tue Feb 16, 2010 9:40 pm
Location: Essex, UK

[SOLVED] String Gadget Text Select Not Working

Post by Nexus100 »

Will only work if I put my code in the right place...Nexus = Doofus (I am tired?)
Hi All

thanks in advance! Have trawled forums and found how to select text but it is not working? Can anyone point me in the right direction:

Code: Select all

           
           UserName = GetGadgetText(#LoginUserNameString)
            PassWord = GetGadgetText(#LoginPWString)
            UserNameLength = Len(Trim(UserName))
            PassWordLength = Len(Trim(PassWord))
            
            If UserNameLength = 0 Or PassWordLength = 0
                MessageRequester("Error","User Name & Password Cannot be Blank!",#PB_MessageRequester_Ok)
                If UserNameLength = 0
                    ;SelectAll(#LoginUserNameString)
                    ;SetActiveGadget(#LoginUserNameString)
                    SendMessage_(GadgetID(#LoginUserNameString),#EM_SETSEL,0,-1)
                ElseIf PassWordLength = 0
                    ;SelectAll(#LoginPWString)
                    ;SetActiveGadget(#LoginPWString)
                    SendMessage_(GadgetID(#LoginPWString),#EM_SETSEL,0,-1)
                EndIf
            Else
This is such a simple kind of task, but driving me slowly to drink (well more drink!)
All watched over by MACHINES..I am little more than #DigitalPlankton
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: [SOLVED] String Gadget Text Select Not Working

Post by MachineCode »

Don't you have to use SetActiveGadget() before or after it? Pretty sure that's what I have to do in one of my apps, but you've got it commented out.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
Post Reply