CoCreate User Forum

CoCreate User Forum (https://www.cocreateusers.org/forum/index.php)
-   Customization (https://www.cocreateusers.org/forum/forumdisplay.php?f=12)
-   -   Open Dialog Position (https://www.cocreateusers.org/forum/showthread.php?t=8219)

Mike_Maenpaa 07-24-2015 09:00 AM

Open Dialog Position
 
1 Attachment(s)
I didn't get any bites in the CED community, so I'll try here.

I'm trying out one of the example LSP from the Help file.
I made one change to the example so that the dialog opens in the right top, but it doesn't seem to work.
Anyone have time to try it and explaing what"s wrong?

While I'm on the subject of dialog boxes, does anyone know if it's possible to have auto-hide capability?

Thanks.

Mike

tom kirkman 07-24-2015 11:38 AM

Re: Open Dialog Position
 
Mike

Add a comment to the location you modified the file. This will help me determine what was changed, so that I can look specifically at that section of code.

Regards

Tom

Mike_Maenpaa 07-24-2015 01:00 PM

Re: Open Dialog Position
 
1 Attachment(s)
Quote:

Originally Posted by tom kirkman (Post 25824)
Mike

Add a comment to the location you modified the file. This will help me determine what was changed, so that I can look specifically at that section of code.

Regards

Tom

Hi Tom,

See the very end of the code attached.

Thanks for looking!

Mike

Andy Poulsen 07-25-2015 06:38 AM

Re: Open Dialog Position
 
Hi Mike,

Some goofy things happen with positioning dialogs sometimes. Not sure why it works in some cases and not in others.

However, one thing I discovered is that if you try to position two dialogs, the first one will get moved to the right location when showing the second. So a little trick that has worked for me is to create a dummy dialog shell at some point in your code (you only need to create it once), as follows:
Code:

(sd-create-dialog-shell "dummy"
  :title "dummy"
  :close t
  :bottomline :none))

and then hide and show it immediately after you show your desired dialog, i.e.:
Code:

  (sd-show-dialog-shell "UICT-TEST"
    :position '("TOP-MENU-TOOLBOX-TB" :righttop 10 10))
  (sd-show-dialog-shell "dummy")
  (sd-hide-dialog-shell "dummy")

Take a look and see if this works.

Mike_Maenpaa 07-27-2015 08:15 AM

Re: Open Dialog Position
 
Quote:

Originally Posted by Andy Poulsen (Post 25826)
Hi Mike,

Some goofy things happen with positioning dialogs sometimes. Not sure why it works in some cases and not in others.

However, one thing I discovered is that if you try to position two dialogs, the first one will get moved to the right location when showing the second. So a little trick that has worked for me is to create a dummy dialog shell at some point in your code (you only need to create it once), as follows:
Code:

(sd-create-dialog-shell "dummy"
  :title "dummy"
  :close t
  :bottomline :none))

and then hide and show it immediately after you show your desired dialog, i.e.:
Code:

  (sd-show-dialog-shell "UICT-TEST"
    :position '("TOP-MENU-TOOLBOX-TB" :righttop 10 10))
  (sd-show-dialog-shell "dummy")
  (sd-hide-dialog-shell "dummy")

Take a look and see if this works.

Thanks Andy, unfortunately that didn't help. It still opens at left top.

Mike

Andy Poulsen 07-29-2015 12:08 PM

Re: Open Dialog Position
 
In working with Mike, we were able to identify and fix the problem.

When trying to specify a position, the function wants a reference widget. In this case, the "TOP-MENU-TOOLBOX-TB" control. The code worked fine in version 17, but not under 18 or 19.

The reason is that this control doesn't exist by default in v18+. We solved the problem by referencing the application itself by using :application rather than a control name.

Perhaps this may be of use to someone else.

Good luck!

andy

tom kirkman 07-30-2015 04:03 AM

Re: Open Dialog Position
 
Andy

Could you provide the sample code?

Thanks

Tom

Andy Poulsen 07-30-2015 09:10 AM

Re: Open Dialog Position
 
1 Attachment(s)
Quote:

Originally Posted by tom kirkman (Post 25830)
Could you provide the sample code?

Hi Tom,

You betcha. The real magic is just to specify the reference object as :application, so the last function in the file becomes:
Code:

  (sd-show-dialog-shell "UICT-TEST" :position '(:application :righttop 10 10))
You can adjust the values, of course, to position it where you want it.

This approach will work under all earlier versions of CoCreate and Creo Elements/Direct, as :application can always be used. However, sometimes you may want to reference another object -- the key is just to make sure it exists before referencing it.

I hope this helps!

andy

Mike_Maenpaa 07-31-2015 12:53 PM

Re: Open Dialog Position
 
1 Attachment(s)
Quote:

Originally Posted by Andy Poulsen (Post 25831)
Hi Tom,

You betcha. The real magic is just to specify the reference object as :application, so the last function in the file becomes:
Code:

  (sd-show-dialog-shell "UICT-TEST" :position '(:application :righttop 10 10))
You can adjust the values, of course, to position it where you want it.

This approach will work under all earlier versions of CoCreate and Creo Elements/Direct, as :application can always be used. However, sometimes you may want to reference another object -- the key is just to make sure it exists before referencing it.

I hope this helps!

andy

Been out of the office for a couple of days, had to take my mom to the hospital.

Thanks again for your help with this Andy!
Also, thanks for the idea about using show/hide control to shrink the size of the dialog when not needed. Hopefully someday they will expose the auto-hide functionality. See attached.

Mike


All times are GMT -8. The time now is 03:39 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.