CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 07-24-2015, 09:00 AM
Mike_Maenpaa Mike_Maenpaa is offline
Registered User
 
Join Date: Aug 2013
Posts: 14
Open Dialog Position

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
Attached Files
File Type: lsp User_Interface_Toolkit_Example.lsp (13.3 KB, 349 views)
Reply With Quote
  #2  
Old 07-24-2015, 11:38 AM
tom kirkman's Avatar
tom kirkman tom kirkman is offline
Registered User
 
Join Date: Oct 2002
Location: Perrysburg, Ohio
Posts: 397
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
__________________
Tom Kirkman

Creo Elements/Direct 20.1
Dell Precision 3581
https://www.o-i.com
Reply With Quote
  #3  
Old 07-24-2015, 01:00 PM
Mike_Maenpaa Mike_Maenpaa is offline
Registered User
 
Join Date: Aug 2013
Posts: 14
Re: Open Dialog Position

Quote:
Originally Posted by tom kirkman View Post
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
Attached Files
File Type: lsp User_Interface_Toolkit_Example.lsp (13.4 KB, 344 views)
Reply With Quote
  #4  
Old 07-25-2015, 06:38 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
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.
__________________
Andy Poulsen
AI MAXTools: Dream. Design. Done. It's that easy!
Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+!
See them in action at www.ai-maxtools.com and then try them for yourself -- FREE!
Reply With Quote
  #5  
Old 07-27-2015, 08:15 AM
Mike_Maenpaa Mike_Maenpaa is offline
Registered User
 
Join Date: Aug 2013
Posts: 14
Re: Open Dialog Position

Quote:
Originally Posted by Andy Poulsen View Post
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
Reply With Quote
  #6  
Old 07-29-2015, 12:08 PM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
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
__________________
Andy Poulsen
AI MAXTools: Dream. Design. Done. It's that easy!
Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+!
See them in action at www.ai-maxtools.com and then try them for yourself -- FREE!
Reply With Quote
  #7  
Old 07-30-2015, 04:03 AM
tom kirkman's Avatar
tom kirkman tom kirkman is offline
Registered User
 
Join Date: Oct 2002
Location: Perrysburg, Ohio
Posts: 397
Re: Open Dialog Position

Andy

Could you provide the sample code?

Thanks

Tom
__________________
Tom Kirkman

Creo Elements/Direct 20.1
Dell Precision 3581
https://www.o-i.com
Reply With Quote
  #8  
Old 07-30-2015, 09:10 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Open Dialog Position

Quote:
Originally Posted by tom kirkman View Post
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
Attached Files
File Type: lsp User_Interface_Toolkit_Example_v18+.lsp (13.4 KB, 343 views)
__________________
Andy Poulsen
AI MAXTools: Dream. Design. Done. It's that easy!
Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+!
See them in action at www.ai-maxtools.com and then try them for yourself -- FREE!
Reply With Quote
  #9  
Old 07-31-2015, 12:53 PM
Mike_Maenpaa Mike_Maenpaa is offline
Registered User
 
Join Date: Aug 2013
Posts: 14
Re: Open Dialog Position

Quote:
Originally Posted by Andy Poulsen View Post
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
Attached Files
File Type: lsp User_Interface_Toolkit_Example_v18+.lsp (13.5 KB, 326 views)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:46 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

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