Page 1 of 1

problem with textbox

Posted: Fri Aug 07, 2009 2:53 pm
by ConvertFromOldNGs
by Bill Gibson >> Sat, 11 Jun 2005 21:53:45 GMT

Hi I'm new to this group but have a little problem I'm hoping someone knows how to solve. is there an equivilent function to the VB SendKeys function as I would like to select the text in a text box when I enter it.

Gratfully yours

Bill Gibson

Re: problem with textbox

Posted: Fri Aug 07, 2009 2:53 pm
by ConvertFromOldNGs
by allistar >> Sat, 11 Jun 2005 22:38:47 GMT

There is a text box property called "selectionStyle". Set this to "SelectionStyle_Retain", "SelectionStyle_Hide" or "SelectionStyle_SelectAll".

Allistar.
--
------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst allistar@silvermoon.co.nz
Auckland, NEW ZEALAND

Silvermoon Software
Specialising in JADE development and consulting
Visit us at: http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at: www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------

Re: problem with textbox

Posted: Fri Aug 07, 2009 2:53 pm
by ConvertFromOldNGs
by Bill Gibson >> Sat, 11 Jun 2005 23:34:53 GMT

Thanks this works but..........only if using tab key .......what about if mouse clicked on textbox I have tried .....Click......GotFocus.....MouseDown....and MouseEnter......to no avail....arghhhh and this is just for me I don't need to implement it but can't let it go.

Bill

Re: problem with textbox

Posted: Fri Aug 07, 2009 2:54 pm
by ConvertFromOldNGs
by Patwos >> Sun, 12 Jun 2005 10:19:11 GMT

You could perhaps try the following code in the gotFocus method to achieve the desired result when clicking with the mouse or tabbing into the field:

vars

begin
textbox.selStart := 0;
textbox.selLength := -1 ;
end;

A caveat on this approach is that in a thin client situation, you are necessitating a round trip to the AppServer every time this textbox gets focus so there will be a performance hit - this will be particularly noticeable on a slow or high latency connection between the thin client and the AppServer.

Hope that helps,
Pat.

Re: problem with textbox

Posted: Fri Aug 07, 2009 2:54 pm
by ConvertFromOldNGs
by Bill Gibson >> Sat, 11 Jun 2005 23:38:28 GMT

by the way it only works if this code is implemented.(well only way I could get to work as I got Unknown Identifier if I used self.txtFName.selectionStyle := SelectionStyle_SelectAll;)

self.txtFName.selectionStyle := TextBox.SelectionStyle_SelectAll;

Bill Gibson

Re: problem with textbox

Posted: Fri Aug 07, 2009 2:54 pm
by ConvertFromOldNGs
by Patwos >> Sun, 12 Jun 2005 10:24:49 GMT

That is the expected behaviour. The constants that Allistair pointed you towards are defined on the TextBox class so you need to dereference them by way of either the class, as you did here, or via a reference or local variable of the appropriate type. eg:

self.txtFName.selectionStyle := self.txtFName.SelectionStyle_SelectAll

You can also set this property at design time in Painter where you know up front what selection style you want. Where possible, setting properties at design time is more efficient in a thin client environment than programmatically setting the properties.

Hope that helps,
Pat.

Re: problem with textbox

Posted: Fri Aug 07, 2009 2:54 pm
by ConvertFromOldNGs
by Bill Gibson >> Sun, 12 Jun 2005 12:42:53 GMT

Thanks that works just fine and dandy

Bill