Table equivalent of selectionStyle in textboxes

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Table equivalent of selectionStyle in textboxes

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:12 pm

by Carl Ranson >> Sun, 7 Feb 1999 23:47:47 GMT

Hi All,

I've just worked out how to make editable text cells in tables become fully selected when the cell gets the focus. This allows the user to overtype existing cell contents.

I added the following method to our descendant of table.

rowColumnChg(table : Table input) updating;

constants
EM_SETSEL = #00B1;
vars
editHandle : Integer;
result : Integer;
begin

inheritMethod(table);
editHandle := call findWindowEx(table.hwnd, 0,'Edit'&0.Character, null); if editHandle <> null then
result := call postMessage(editHandle, EM_SETSEL, 0,-1);
endif;
end;

This accesses and sets the selection of a textbox "window" (in the windows sense) whenever the cell changes. A similar technique can be used to access the combobox jade uses for inputType_combo cells.

You may also need to setup the following two external functions

findWindowEx(hwndParent : Integer; hwndChildAfter : Integer; classname : String; windowname : String) : Integer is FindWindowExA in user32; postMessage(hwnd:Integer; msg:Integer; wparam:Integer; lparam:Integer):Integer is PostMessageA in user32;

Regards

Carl Ranson (Turing Solutions Ltd)

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Table equivalent of selectionStyle in textboxes

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:12 pm

by Craig Shearer >> Mon, 8 Feb 1999 0:23:54 GMT

This is great Carl. You get my vote for cool tip of the day/week/month/year!!!

Craig.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Table equivalent of selectionStyle in textboxes

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:12 pm

by Torrie Moore >> Fri, 25 Jun 1999 5:06:21 GMT

I am using similar code to the the code posted to select the text in a cell. The method that returns the handle of the edit box often fails and returns 0. I can't figure out why. Has onyone else had this problem and if so how can I fix it?

Torrie Moore


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 1 guest