Page 1 of 1

[SOLVED] String Gadget Text Select Not Working

Posted: Sat Oct 08, 2011 8:53 pm
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!)

Re: [SOLVED] String Gadget Text Select Not Working

Posted: Sun Oct 09, 2011 1:03 am
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.