Difference between revisions of "Child tables"
|Line 123:||Line 123:|
Revision as of 11:20, 29 October 2013
Child Table, Grid & Column
What message is send when a DropDown column item is selected (clicked)
When an item from a column dropdown list is selected, the message SAM_AnyEdit is send to the column message actions section.
How to hide the window displayed in the taskbar when a column dropdown list is opened
When you open the dropdown list of a table column, a window is shown on the Windows taskbar.
To get rid of this window use this code under the message actions of the table column
First declare these three WinApi functions in the external functions section
Library name: USER32.DLL Function: FindWindowA Export Ordinal: 0 Returns Window Handle: HWND Parameters String: LPCSTR String: LPCSTR Function: GetWindowLongA Export Ordinal: 0 Returns Number: LONG Parameters Window Handle: HWND Number: INT Function: SetWindowLongA Export Ordinal: 0 Returns Number: LONG Parameters Window Handle: HWND Number: INT Number: LONG
Also declare these constants
Number: GWL_EXSTYLE = -20 Number: WS_EX_TOOLWINDOW = 0x80
Here the actual code for removing the window from the taskbar
On SAM_DropDown Set hWndDropDown = FindWindowA( "Gupta:DropDown", "" ) If NOT hWndDropDown ! Maybe it is an older TD version, so search for another classname Set hWndDropDown = FindWindowA( ":DropDown", "" ) If hWndDropDown If NOT GetWindowLongA( hWndDropDown,GWL_EXSTYLE ) & WS_EX_TOOLWINDOW Call SetWindowLongA( hWndDropDown, GWL_EXSTYLE, GetWindowLongA( hWndDropDown,GWL_EXSTYLE ) | WS_EX_TOOLWINDOW )
Here you can download a sample:
Double Height column headers
It wasn't obvious to me that this could be done but the business analyst really wanted it for her screen design. A coworker remembered how she had done it once: Just embed a newline in the column title and Gupta handles it automgically. Works at design time, just embed ctrl/enter in the column's "Object Title" property, or at run time using SalTblSetColumnTitle()
Call SalTblSetColumnTitle ( tblX.columnN, "Column header part 1 column header part 2" )
How to set popup-edit columns to read-only or to disabled state
On columns having cell-type 'Popup edit' there are only two states available:
- Editable Yes
- Editable No
When the column is editable, the text inside the popup edit box can be selected and changed.
When the column is not editable, the popup edit box is not presented when clicking on a cell.
So it is not possible to see the contents of a cell without allowing the user to change the text.
The next solution adds two more options for Popup edit columns:
The trick is to get the window handle of the popup edit box and use it to set it to read-only or disabled states.
Declare these constants
Number: WM_USER = 0x0400 Number: SAM_GetExtEdit = WM_USER + 119 Number: EM_SETREADONLY = 0x00CF
The constant SAM_GetExtEdit is an internal undocumented message to get the edit part of popup edit columns.
The next piece of code shows how to get the window handle of the edit box and set it to read-only or disabled.
Here is a table called tblTest which contains a column col1 having type 'Popup edit':
Set nPopup = SalSendMsg( tblTest, SAM_GetExtEdit, SalTblQueryColumnID( tblTest.col1 ) - 1, 0 ) If nPopup > 0 Set hWndPopUp = SalNumberToWindowHandle( nPopup ) ! Set it to READ ONLY Call SalSendMsg( hWndPopUp, EM_SETREADONLY, TRUE, 0 ) ! Or set it to disabled Call SalDisableWindow( hWndPopUp )
Here you can download a sample: