June 28, 2024, 12:22:26 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


SD DataGrid Message

Started by ckoehn, January 29, 2010, 01:43:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ckoehn

The SD Data Grid gives the message below when a user clicks a combobox on the grid.  How do you access a combobox control with just the Hwnd?


COMBO_FILL

The COMBO_FILL message is sent whenever the dropdown listbox of a combobox field is about to be displayed. The application should load the elements for the listbox at this time.

COMBO_FILL
IDgrid = LOWORD(wParam)
hWndCombo = HIWORD(wParam)
Row = LOWORD(lParam)
Column = HIWORD(lParam)

Parameters

IDgrid
The application defined identification number of the grid control. This is the ID number assigned to the grid when it was created.

hWndCombo
The handle of the combobox.

Row
The row number of the record.

Column
The column number of the cell.

Return Values
If your application processes this message it should return 0.




LarryMc

January 29, 2010, 02:11:36 PM #1 Last Edit: January 29, 2010, 02:16:09 PM by Larry McCaughn
Use the EBasic command GETCONTROLHANDLE (See the help file) is what is usually used.

However, without seeing how the Combobox is created, I really can't know for sure.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ckoehn

Sorry Larry that I'm not making myself clear.  Will try again.

I have a handle to a combo box (SD Data Grid gives me that).  How do you access the combo box if all you have is a handle?  I think SendMessage would work if I knew how to use that.

Thanks  for you help as always.

ckoehn

Larry,

Found the problem.  I was parsing the WPARAM wrong.  The Control handle is the HighWord of WPARAM and I was using the LowWord.

Posting sometimes helps the brain to work. :-[

sapero

January 29, 2010, 02:37:22 PM #4 Last Edit: January 29, 2010, 04:39:22 PM by sapero
$include "windowssdk.inc"

SendMessage(hwnd, CB_ADDSTRING, 0, "some string")

But I'm not sure about the 16-bit handle returned from HIWORD(wParam). If you run Spy++ tool from MSDN, any other "window picker", or enumerate windows with Enum{Child}Windows, you'll see that there is no HWND that fits in 16 bits. Maybe in win95, or the description of wParam in COMBO_FILL is wrong.

Proof:$include "windowssdk.inc"
$include "stdio.inc"

HWND g_hwndMin = 0x7FFFFFFF
int  g_ShortCount = 0
int  g_LongCount = 0

EnumChildWindows(0, &EnumProc, 0)
string s
sprintf(s, "found %d windows, %d of them fits in 16 bits. Lowest HWND: 0x%.8x", g_ShortCount+g_LongCount, g_ShortCount, g_hwndMin)
messagebox 0, s, ""
end

sub EnumProc(HWND hwnd, LPARAM lParam),BOOL
if (!(hwnd>>16)) then g_ShortCount++ else g_LongCount++
g_hwndMin = __min(g_hwndMin, hwnd)
return TRUE
endsub

ckoehn

Thanks for looking at it Sapero.  No idea why it is only 16 bits but it seems to work.  I was able to add strings to the combo box using the handle that it returned.

sapero

January 29, 2010, 04:32:02 PM #6 Last Edit: January 29, 2010, 04:38:44 PM by sapero
After a little research, I can say that the documentation is not correct. It is an ATOM, not HWND.
ATOM (16 bit value) is returned when you call RegisterClassEx, and (instead HWND) it may be passed to SendMessage function (maybe).

Oficially you can pass ATOM instead class name to CreateWindowEx, GetClassInfoEx, FindWindow, FindWindowEx functions, but what about SendMessage?