realbasic-plugins
[Top] [All Lists]

Re: Tabpanel problem

To: <dan dot cooper at xpsprint dot co dot uk>, REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Tabpanel problem
From: Alfred Van Hoek <vanhoek at mac dot com>
Date: Wed, 10 Nov 2004 07:36:51 -0500
Cc:
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
on 11/10/04 5:19 AM, Dan Cooper at dan dot cooper at xpsprint dot co dot uk 
wrote:

> Here is the revised code, in the boxDraw event:
> if( hInstHandle == NULL ) {
> ControlData(pickerControl, instance, pickerData, data);
> REALwindow realWnd =
> REALGetControlWindow(REALGetControlParent(instance));
> HWND winRef = REALGetWindowHandle(realWnd);
> hInstHandle = (HINSTANCE)GetWindowLong(winRef, GWL_HINSTANCE);
> Rect rect;
> REALGetControlBounds(instance, &rect);
> hWindowHandle = CreateWindowEx(0, "SysDateTimePick32", 0,
> WS_CHILD + WS_BORDER + WS_VISIBLE, rect.left, rect.top, rect.right -
> rect.left, rect.bottom - rect.top, winRef, 0, hInstHandle, 0);
> BringWindowToTop(hWindowHandle);
> }

Right, if hInstance is derived from the controlParent then of course
hInstance will always be the same. In addition, you bypass the HWND-child RB
has already created for you. You may want to use this HWND-child to obtain
the hInstance, instead of the hwnd from the REALwindow.

Thus:

 HINSTANCE hinstance =
     (HINSTANCE)GetWindowLong(REALGetControlHWND(instance), GWL_HINSTANCE);

winRwf = REALgetControlHandle(instance);
                   
wHwnd = CreateWindowEx( 0,
                "SysDateTimePick32",
                0, 
                WS_CHILD + WS_BORDER + WS_VISIBLE,
                0, 
                0, 
                rect.right - rect.left,
                rect.bottom - rect.top,
                winRef,
                0, 
                hInstHandle,
                0
                 );

Now your wHwnd lives on the controlHWND and not on the REALwindow,

Alfred

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>