Xojo Conferences
XDCMay2019MiamiUSA

Tabpanel problem (Real Studio Plugins Mailinglist archive)

Back to the thread list
Previous thread: REALclassRef and the precreation of a window
Next thread: Re: (no subject) firewire


macosx and unix paths   -   GOLD
  Tabpanel problem   -   Dan Cooper
   Re: Tabpanel problem   -   Alfred Van Hoek
    Re: Tabpanel problem   -   Dan Cooper
     Re: Tabpanel problem   -   Alfred Van Hoek
      Re: Tabpanel problem   -   Dan Cooper
       Re: Tabpanel problem   -   Alfred Van Hoek
        Re: Tabpanel problem   -   Dan Cooper
         Re: Tabpanel problem   -   Alfred Van Hoek
          Re: Tabpanel problem   -   Dan Cooper

Tabpanel problem
Date: 09.11.04 15:44 (Tue, 09 Nov 2004 14:44:30 +0000)
From: Dan Cooper
I have a problem with a control plug-in I wrote and page panel, it works
fine when there is just one on the page but if I add another one is
always visible no matter which page is being displayed but the other
shows on the correct page.

The code I'm using to show/hide them is:

void boxStateChanged(REALcontrolInstance instance, unsigned long
changedField)
{
if( REALinRuntime() && changedField =V ) {
if( REALGetTabPanelVisible(instance) = ) {
ShowWindow(mWnd, SW_HIDE);
} else if( REALGetTabPanelVisible(instance) =! ) {
ShowWindow(mWnd, SW_SHOW);
}
}
}

Does this look correct? Or am I going about it the wrong way?

Dan.
_______________________________________________
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>

Re: Tabpanel problem
Date: 09.11.04 16:20 (Tue, 09 Nov 2004 10:20:19 -0500)
From: Alfred Van Hoek
on 11/9/04 9:44 AM, Dan Cooper at <email address removed> wrote:

> I have a problem with a control plug-in I wrote and page panel, it works
> fine when there is just one on the page but if I add another one is
> always visible no matter which page is being displayed but the other
> shows on the correct page.
>
> The code I'm using to show/hide them is:
>
> void boxStateChanged(REALcontrolInstance instance, unsigned long
> changedField)
> {
> if( REALinRuntime() && changedField =e ) {
> if( REALGetTabPanelVisible(instance) =o ) {
> ShowWindow(mWnd, SW_HIDE);
> } else if( REALGetTabPanelVisible(instance) =W ) {
> ShowWindow(mWnd, SW_SHOW);
> }
> }
> }
>
> Does this look correct? Or am I going about it the wrong way?
>

This looks correct, and if each controlInstance has its own mWnd then I am
stumped. Looks like somewhere else in your code a problem exists...

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>

Re: Tabpanel problem
Date: 09.11.04 17:36 (Tue, 09 Nov 2004 16:36:55 +0000)
From: Dan Cooper
I am gaining the HWND in the Open event of the plugin, using the code:

void boxOpen(REALcontrolInstance instance)
{
if( REALinRuntime() ) {
hInst = instance;
REALwindow realWnd = REALGetControlWindow(instance);
HWND winRef = REALGetWindowHandle(realWnd);
mWnd = CreateWindowEx(0, "SysDateTimePick32", 0, WS_CHILD +
WS_BORDER + WS_VISIBLE + flags, rect.left, rect.top, rect.right -
rect.left, rect.bottom - rect.top, winRef, 0, hInstance, 0);
BringWindowToTop(mWnd);
}
}

(mWnd is the handle I am showing/hiding in the StateChanged event)

Does that look correct? It appears that however many instances I add of
the control, only the last one added shows and hides correctly.

Dan.





on 11/9/04 9:44 AM, Dan Cooper at dan dot cooper at xpsprint dot co dot uk
wrote:

>/ I have a problem with a control plug-in I wrote and page panel, it works/
>/ fine when there is just one on the page but if I add another one is/
>/ always visible no matter which page is being displayed but the other/
>/ shows on the correct page./
>/ /
>/ The code I'm using to show/hide them is:/
>/ /
>/ void boxStateChanged(REALcontrolInstance instance, unsigned long/
>/ changedField)/
>/ {/
>/ if( REALinRuntime() && changedField =m ) {/
>/ if( REALGetTabPanelVisible(instance) =
) {/
>/ ShowWindow(mWnd, SW_HIDE);/
>/ } else if( REALGetTabPanelVisible(instance) =) ) {/
>/ ShowWindow(mWnd, SW_SHOW);/
>/ }/
>/ }/
>/ }/
>/ /
>/ Does this look correct? Or am I going about it the wrong way?/
>/ /

> This looks correct, and if each controlInstance has its own mWnd then I am
> stumped. Looks like somewhere else in your code a problem exists...
>
> 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>

Re: Tabpanel problem
Date: 09.11.04 18:19 (Tue, 09 Nov 2004 12:19:39 -0500)
From: Alfred Van Hoek
on 11/9/04 11:36 AM, Dan Cooper at <email address removed> wrote:

> I am gaining the HWND in the Open event of the plugin, using the code:
>
> void boxOpen(REALcontrolInstance instance)
> {
> if( REALinRuntime() ) {
> hInst = instance;
> REALwindow realWnd = REALGetControlWindow(instance);
> HWND winRef = REALGetWindowHandle(realWnd);
> mWnd = CreateWindowEx(0, "SysDateTimePick32", 0, WS_CHILD +
> WS_BORDER + WS_VISIBLE + flags, rect.left, rect.top, rect.right -
> rect.left, rect.bottom - rect.top, winRef, 0, hInstance, 0);
> BringWindowToTop(mWnd);
> }
> }
>
> (mWnd is the handle I am showing/hiding in the StateChanged event)
>
> Does that look correct? It appears that however many instances I add of
> the control, only the last one added shows and hides correctly.
>
> Dan.

Couple of things:

REALGetControlWindow calling in the open event on mac is save, but not on
windows. On windows you would want to call REALGetControlWindow at the first
pass through boxDraw.

And even better inspection of the above shows that you are not getting the
child from winRef (which likely is nil) but from the hInstance which does
not point to a HWND.

My guess is that you need to work on the above to make sure that each winRef
is the child of the correct parent HWND.

Good luck,

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>

Re: Tabpanel problem
Date: 09.11.04 18:45 (Tue, 09 Nov 2004 17:45:20 +0000)
From: Dan Cooper
It looks like the instance passed in boxOpen is not unique, the global
hInst property when the first control is created is NULL but on the
second instance of the control, it contains the handle to the first
control, how do I get a handle to each instance of the control?

Dan.




Alfred Van Hoek wrote:

>on 11/9/04 11:36 AM, Dan Cooper at <email address removed> wrote:
>
>>I am gaining the HWND in the Open event of the plugin, using the code:
>>
>>void boxOpen(REALcontrolInstance instance)
>>{
>>if( REALinRuntime() ) {
>>hInst = instance;
>>REALwindow realWnd = REALGetControlWindow(instance);
>>HWND winRef = REALGetWindowHandle(realWnd);
>>mWnd = CreateWindowEx(0, "SysDateTimePick32", 0, WS_CHILD +
>>WS_BORDER + WS_VISIBLE + flags, rect.left, rect.top, rect.right -
>>rect.left, rect.bottom - rect.top, winRef, 0, hInstance, 0);
>>BringWindowToTop(mWnd);
>>}
>>}
>>
>>(mWnd is the handle I am showing/hiding in the StateChanged event)
>>
>>Does that look correct? It appears that however many instances I add of
>>the control, only the last one added shows and hides correctly.
>>
>>Dan.
>>
>Couple of things:
>
>REALGetControlWindow calling in the open event on mac is save, but not on
>windows. On windows you would want to call REALGetControlWindow at the first
>pass through boxDraw.
>
>And even better inspection of the above shows that you are not getting the
>child from winRef (which likely is nil) but from the hInstance which does
>not point to a HWND.
>
>My guess is that you need to work on the above to make sure that each winRef
>is the child of the correct parent HWND.
>
>Good luck,
>
>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>

Re: Tabpanel problem
Date: 09.11.04 19:00 (Tue, 09 Nov 2004 13:00:40 -0500)
From: Alfred Van Hoek
on 11/9/04 12:45 PM, Dan Cooper at <email address removed> wrote:

> It looks like the instance passed in boxOpen is not unique,

there you go.

> the global
> hInst property when the first control is created is NULL but on the
> second instance of the control, it contains the handle to the first
> control, how do I get a handle to each instance of the control?

Right,

1) hInstance: you need the GWL_HINSTANCE of the HWND, the instance should
live on (HWND will be the parent of mWnd)
2) you need to register with WNDCLASSEX
3) to obtain the parent HWND you should inquire at the first pass through
boxdraw and *not* boxopen.

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>

Re: Tabpanel problem
Date: 10.11.04 11:19 (Wed, 10 Nov 2004 10:19:55 +0000)
From: Dan Cooper
Okay,

I understand that I need to gain the HWND and Instance in the first
boxDraw event which works fine, it creates the control fine, just need
to clarify how I can store the instance handle correctly if the variable
'hInst' is accessed by both instances of the control and therefore only
registers the first instance handle, also, do I need to register with
WNDCLASSEX if I am using a registered control class already
(SysDateTimePick32)?

Here is the revised code, in the boxDraw event:
if( hInstHandle = ULL ) {
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);
}

Does that look right? It is still only hiding the last control created.

Thanks,
Dan.



Alfred Van Hoek wrote:

>on 11/9/04 12:45 PM, Dan Cooper at <email address removed> wrote:
>
>>It looks like the instance passed in boxOpen is not unique,
>>
>there you go.
>
>>the global
>>hInst property when the first control is created is NULL but on the
>>second instance of the control, it contains the handle to the first
>>control, how do I get a handle to each instance of the control?
>>
>Right,
>
>1) hInstance: you need the GWL_HINSTANCE of the HWND, the instance should
>live on (HWND will be the parent of mWnd)
>2) you need to register with WNDCLASSEX
>3) to obtain the parent HWND you should inquire at the first pass through
>boxdraw and *not* boxopen.
>
>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>

Re: Tabpanel problem
Date: 10.11.04 13:36 (Wed, 10 Nov 2004 07:36:51 -0500)
From: Alfred Van Hoek
on 11/10/04 5:19 AM, Dan Cooper at <email address removed> wrote:

> Here is the revised code, in the boxDraw event:
> if( hInstHandle =(ULL ) {
> 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>

Re: Tabpanel problem
Date: 10.11.04 14:21 (Wed, 10 Nov 2004 13:21:13 +0000)
From: Dan Cooper
Sorry to keep asking but I just can't figure this out, I'm using this
code now:

ControlData(pickerControl, instance, pickerData, data);
hInstHandle = (HINSTANCE)GetWindowLong(REALGetControlHWND(instance),
GWL_HINSTANCE);
HWND winRef = REALGetControlHandle(instance);
Rect rect;
REALGetControlBounds(instance, &rect);
hWindowHandle = CreateWindowEx(0, "SysDateTimePick32", 0, WS_CHILD +
WS_BORDER + WS_VISIBLE + flags, rect.left, rect.top, rect.right -
rect.left, rect.bottom - rect.top, winRef, 0, hInstHandle, 0);
BringWindowToTop(hWindowHandle);

Now, the hWindowHandle is returning a valid HWND so it looks like the
control is being created but it is now not visible at all.

Any more help would be greatly appreciated.

Thanks,
Dan.





Alfred Van Hoek wrote:

>on 11/10/04 5:19 AM, Dan Cooper at <email address removed> wrote:
>
>>Here is the revised code, in the boxDraw event:
>>if( hInstHandle =>ULL ) {
>>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>