It is currently Sat May 18, 2013 10:11 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: StringGadget Caret
PostPosted: Sun Jul 15, 2012 10:30 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Feb 03, 2011 7:44 pm
Posts: 164
When I use this code for a StringGadget to limit the number of characters to 2 the mouse cursor always disappears when I type anything.
Code:
Length=Len(GetGadgetText(#Input_Minutes1))
If Length>2
  SetGadgetText(#Input_Minutes1,Mid(GetGadgetText(#Input_Minutes1),0,2))
  SendMessage_(GadgetID(#Input_Minutes1),#EM_EXGETSEL,2,2)
EndIf


How do you stop the mouse cursor from disappearing?
Edit: By cursor I mean Mouse Cursor!


Last edited by Nubcake on Sun Jul 15, 2012 10:59 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: StringGadget Caret
PostPosted: Sun Jul 15, 2012 10:54 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2852
Location: Wales, UK
If your app is for Windows:
Code:
SendMessage_(GadgetID(#Input_Minutes1),#EM_SETSEL,Length,Length);Set cursor to end of string

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: StringGadget Caret
PostPosted: Sun Jul 15, 2012 10:56 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Feb 03, 2011 7:44 pm
Posts: 164
IdeasVacuum wrote:
If your app is for Windows:
Code:
SendMessage_(GadgetID(#Input_Minutes1),#EM_SETSEL,Length,Length);Set cursor to end of string

The mouse cursor still disappears , it only reappears when you move the mouse :(
Edit: By cursor I mean Mouse Cursor!


Top
 Profile  
 
 Post subject: Re: StringGadget Caret
PostPosted: Sun Jul 15, 2012 11:30 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2256
Location: UK
It's supposed to disappear, it's the correct behaviour.


Top
 Profile  
 
 Post subject: Re: StringGadget Caret
PostPosted: Sun Jul 15, 2012 11:32 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2852
Location: Wales, UK
Quote:
The mouse cursor still disappears , it only reappears when you move the mouse


But that is normal Windows behavior? The mouse cursor changes to a Caret when it enters a StringGadget - move it out of a StringGadget and it goes back to whatever it previously was (default = arrow).

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: StringGadget Caret
PostPosted: Sun Jul 15, 2012 11:34 pm 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 1467
If you still need it next is a workaround

Code:
  OpenWindow(0, 0, 0, 322, 205, "StringGadget Flags", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    StringGadget(0, 8,  10, 306, 20, "Normal StringGadget...")
    SendMessage_(GadgetID(0),#EM_SETLIMITTEXT,2,0)
Repeat
  Select WaitWindowEvent()
     
       Case #PB_Event_CloseWindow
              Quit = 1
     
       Case #PB_Event_Gadget
          Select EventGadget()
           Case 0
                GetCursorPos_(p.POINT)
                SetCursorPos_(p\x,p\y)

          EndSelect
  EndSelect
         
Until Quit = 1

_________________
Egypt my love


Top
 Profile  
 
 Post subject: Re: StringGadget Caret
PostPosted: Mon Jul 16, 2012 12:11 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Feb 03, 2011 7:44 pm
Posts: 164
Polo wrote:
It's supposed to disappear, it's the correct behaviour.

:oops: I forgot about that.

Anyways thanks RASHAD works perfectly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye