On Jan 20, 2006, at 12:47 AM, Suikyo wrote:
I make REALcontrol.
Because I cannot acquire HWND of control with initFunction of behavior
and openFunction, I acquire it with controlHandleGetter.
The initFunction on Mac and Windows and openFunction on WIndows are
fired to early to obtain a valid HWND from a REALcontrolInstance and
therefore you indeed should inquire about a HWND after these
instance-callbacks. I presume that the following code is called after
these callbacks, since you obtain a valid HWND.
A source is as follows.
ULONG controlHandleGetter( REALcontrolInstance instance )
{
ControlData(ListViewExControl,instance,LSTVIEWX,data);
HWND hwnd;
hwnd = REALGetControlHandle( instance );
if(REALinRuntime()){
if(hwnd && data->hWnd==NULL)
{
data->hWnd = hwnd;
//CreateWindowEx and set control style
_lvx_on_create(instance);
//Fire true Open event
void (*fp)(REALcontrolInstance instance);
fp = (void (*)(REALcontrolInstance instance))
REALGetEventInstance(instance, &lvxEvents[0]);
if (fp) fp(instance);
I presume that your REALeventInstance (lvxEvents[0]) is defined as
"Open", and this is problematic because RB defines already an "Open"
event for any REALcontrol. Change the definition of lvxEvents[0] into
"MyOpen" to test. Then you should be able to set properties of your
control in the "MyOpen" event.
lvxStateChanged(instance,kBoundsChanged);
UINT id;
data->hThread = (HANDLE)_beginthreadex( NULL, 0,
&_lvx_threadproc, (LSTVIEWX*)data, 0, &id );
if((LONG)data->hThread==-1L) _DEBUG(L"failed _beginthreadex.
(reason=%d)",GetLastError());
}
}
return (ULONG)hwnd;
}
However, I can make control in this way, but the property that I set
with IDE is not succeeded to.
What kind of case will you use controlHandleGetter for?
Don't know what you mean here. REALGetControlWIndow or REALGetHWND are
the correct api's to obtain the HWND, and your code above looks fine to
me, apart from assumptions raised above,
Alfred
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|