PDA

View Full Version : Multi-monitor support with Codejock controls?



chuckatkinson
5-May-2009, 03:14 PM
Do the standard codejock controls (e.g. TaskDialog etc.) support multi-monitor 'memory'.

I ask because when I popup a sigCJYesNo_Box, it always pops up on the main monitor screen regardless of which monitor the app is running from.

Thanks

Martin
7-May-2009, 06:12 AM
Good point:( I've just tested one of our application and :mad:

Ho Hum! We'll look into it.

Ian Smith
7-May-2009, 08:08 AM
Hi Chuck

We nearly got this right:)

If you look at
Object oInfoDialog_btn is a buttonin SigCJTaskDialogDemo.vw (should be line 80)

In the OnClick we have the line
Set pbRelativePosition of hoDialog to TrueThis tells the control to position the popup relative to the Parent Window… however we are not telling the control what the parent window is:eek:

I added the following after Set pbRelativePosition of hoDialog to True.


Handle hParent
Get (Parent(oSigCJTaskDialogDemo_View(Self))) to hParent
Set ComParentHWDN of hoDialog to hParentThe above gets the windows handle of the client area, but anything can be the parent.

Ian Smith
7-May-2009, 08:12 AM
Doh... It helps if I check the class code before replying

You should set phParentHwnd and not ComParentHWDN

chuckatkinson
7-May-2009, 08:52 AM
Thanks Ian

Here's what works for me. This is in the OnComClick of the button in my view.



Get Window_Handle of (Parent(Self)) to hParent
Set phParentHwnd of hoDialog to hParent

Vincent Oorsprong
7-May-2009, 11:40 PM
Ian,

The following is a wrong piece of code:



Get (Parent(oSigCJTaskDialogDemo_View(Self))) to hParent


You either write:


Get Parent Of oSigCJTaskDialogDemo_View to hParent

or:


Move (Parent(oSigCJTaskDialogDemo_View)) to hParent


PS: I also took out the SELF, is not needed in this kind of code anymore for quite a while.

chuckatkinson
8-May-2009, 08:06 AM
Thanks for the tips.

However the following code will not compile and gives this error



Get Window_Handle of Parent to hParent

- Error 4394: C:\VDF\purchasing\AppSrc\PurchaseOrderEntry.vw (ln 404) Invalid object reference "Already defined as a function"
This however does compile



Get Window_Handle of (Parent(Self)) to hParent
So is SELF still needed ?

Thanks

chuckatkinson
8-May-2009, 08:23 AM
I've gone back and tried a few things and this seems to work. Would this be the preferred method for getting the window_handle of the client for proper relative positioning of a codejock popup taskdialog.



Get Client_Id to hClient
Get Window_Handle of hClient to hParent
The above hParent actually returns a different number than the code below:




Get Window_Handle of (Parent(self)) to hParent

But the popup does position correctly on the screen using the Client_ID Window_Handle method.

Any tips are appreciated.

Thanks

Anders Ohrt
8-May-2009, 09:51 AM
Thanks for the tips.

However the following code will not compile and gives this error



Get Window_Handle of Parent to hParent

- Error 4394: C:\VDF\purchasing\AppSrc\PurchaseOrderEntry.vw (ln 404) Invalid object reference "Already defined as a function"
This however does compile



Get Window_Handle of (Parent(Self)) to hParent
So is SELF still needed ?

Thanks

The proper syntax for Get is


Get <property or function> of <object> to <value>
In your first example, you don't have an object named Parent, so compilation fails. But since (Parent(Self)) is syntactic sugar for Get Parent of Self, which gets the parent object, this compiles.

If you want verbose code without Self you could do this:



Get Parent to hoParent
Get Window_Handle of hoParent to hWindow

chuckatkinson
8-May-2009, 11:03 AM
Thanks Anders. Yes you are correct.

In regards to the codejock controls as far as positioning for multi-monitor, I believe the window_handle should be the client_id of the current object. In my case I am popping up a taskdialog from a button and want it to center on the view object. My button is not on the view itself, so it's parent is not the client area, so using client_id works a charm.

Vincent Oorsprong
8-May-2009, 01:05 PM
Chuck,

Anders explained it well. I did not say SELF is not needed anymore, it is not needed in the kind of call I wrote. The problem was the GET in combination with the passed expression. It would execute a message with the ID equal to the result of the expression.