PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on December 03, 2010, 05:33:01 PM

Title: Select Text.. What am I doing wrong
Post by: Martin Francom on December 03, 2010, 05:33:01 PM
I have a form and on that form is a number of TextBox controls.  I have set the property "SelText"  to TRUE.   When I run the form the contents of the TextBox control will be "selected" if I TAB to the control but if I use my mouse and click on the control the contents are not "selected".

Is this how "SelText" is supposed to work?   How can I get the contents of the TextBox control to be "selected" when I click into the control?

Title: Re: Select Text.. What am I doing wrong
Post by: Paul Squires on December 03, 2010, 08:56:30 PM
You could try setting the selection during the WM_LBUTTONUP message handler:


'--------------------------------------------------------------------------------
Function FORM1_TEXT1_WM_LBUTTONUP ( _
                                    ControlIndex  As Long,  _  ' index in Control Array
                                    hWndForm      As Dword, _  ' handle of Form
                                    hWndControl   As Dword, _  ' handle of Control
                                    MouseFlags    As Long,  _  ' virtual keys that are pressed
                                    xPos          As Long,  _  ' x-coordinate of cursor
                                    yPos          As Long   _  ' y-coordinate of cursor
                                    ) As Long

   FF_TextBox_SetSel hWndControl, 0, -1

End Function

Title: Re: Select Text.. What am I doing wrong
Post by: Martin Francom on December 04, 2010, 03:52:59 PM
Paul,
   Thanks for the suggestion. I will give it a try.

Out of curiousity,  Is this the normal behavior for when a textbox control property is set to SelText to True.  I use several other windows programs where mouse clicking into a TextBox will select the text contained therein.  If it is possible I would like to see that be the behavior when a FF TextBox SelText property is set to True.  Is that possible? 
Title: Re: Select Text.. What am I doing wrong
Post by: Rolf Brandt on December 05, 2010, 07:27:16 AM
That is the normal behaviour. The textbox will select the text when it gets the focus, so that its contents are overwritten when you start typing. A mouseclick will deselect the text. The idea is that you can can use the mouse to select the point in the text to make changes, or select part of the text.

If you want to have all text selected when you click the textbox you would have to program that manually.
Title: Re: Select Text.. What am I doing wrong
Post by: Klaas Holland on December 07, 2010, 06:39:04 AM
You could doubleclick on the Textbox to select, perhaps you forgot.