CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 04-01-2008, 12:21 AM
Bobo82 Bobo82 is offline
Registered User
 
Join Date: May 2007
Location: Bologna, Italy
Posts: 22
Creation of button box

Hi all,
I need help for solve this little problem.
I have create a simple function in lisp that modify the current style for the manual geometry in Annotation:

PHP Code:
(defun line_style ()
  (
modify_default_setting :path "Annotation/Geometry/Standard" :a_range :LINENORMAL)
 ) 
After adding a new command in the user_avail_cmds.cmd:

PHP Code:
(:Application "Annotation")

(:
Group "AMTools" :title "AMTools")

(
"line_style"
 
:title       "Standard line style"
 
:action      "(line_style)"
 
:description "Set standard line style"
 
:image       "/bmp/Annotation/standard.bmp")
 :
ui-behavior :DEFAULT) 
Now I need to create a new menù in the annotation main taskbar with a button that call the function "line_style".

I have created the menù with this code:

PHP Code:
(sd-add-menu-button "AMTools"
             
:parent   '("TASK" "Annotation")
             :label    "AMTools"
             :image    "/bmp/immage.bmp")
             :mapMenu  "AMAdd-on")

(sd-create-menu "AMAdd-on"
   :title "AMTools"
   :contents
   '
(
     (:
buttonBox "Set style"
      
:title  "Set style"
      
:fillOrder :asIs
      
:buttons (
                    (
"(line_style)" :label "Standard" :availCmd ("Annotation" "AMTools" "line_style"))
                   )
    )

Now the new menù is correctly displayed and the command works, peraps the problem is the behavior of the command:
when the button was pressed for the first time the function line_style is called and works, but the button is not released and looks like "pressed".
When I push it again the function is not called and the button was released.

What's wrong in the command definition?
It's possible to create a button that don't have the behavior of a toggle-button calling a simple function and not a dialog?
The same definition for a command that call a dialog works correctly...

Thank to all.
Reply With Quote
  #2  
Old 04-01-2008, 01:07 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: Creation of button box

I never used this functionality myself, so this is just a wild guess: Maybe line_style needs to be defined as a dialog (via sd-defdialog), not a function (via defun).

Also, you may want to use a name which is less likely to collide with existing ones, i.e. something like bobo82_line_style, or (better) define the function in its own Lisp package.

Claus
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #3  
Old 04-01-2008, 01:44 AM
Bobo82 Bobo82 is offline
Registered User
 
Join Date: May 2007
Location: Bologna, Italy
Posts: 22
Re: Creation of button box

Thanks for your reaction Clausb,
the code I posted was little simplified...
I have already create my lisp package and the real name of the function is:

"setta_linea_continua"

so the buttonbox definition looks like:

PHP Code:
:buttons (
          (
"(mypackage::setta_linea_continua)" :label "Standard" :availCmd ("Annotation" "AMTools" "setta_linea_continua"))
          ) 
I have translated the name of the function to make the code more readeble for poepole don't speak italian.

I try some different way, whit different function, to create the button but the resul is the same...

It's look like that all the buttonbox have to call a dialog for works correctly, but in the standard OSDM menù there are some button that not call a dialog and works correctly ...

The idea of call the function whit a sd-defdialog it's a workaround that I can use, but it's mean one more click from the user to confirm the action for each time.

Thanks again for you kind answer.

Bobo
Reply With Quote
  #4  
Old 04-01-2008, 12:23 PM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 754
Re: Creation of button box

Quote:
Originally Posted by Bobo82 View Post
The idea of call the function whit a sd-defdialog it's a workaround that I can use, but it's mean one more click from the user to confirm the action for each time.
No there's no need to click 'ok', when using the 'right' dialog:
PHP Code:
(sd-defdialog 'doit_once
 :dialog-control :sequential
 ;;; not any variables
 :ok-action '
(mypackage::setta_linea_continua)
 ) 
Yes. using defdialog looks like an over kill here. But using a standard tool you will get a lot for free. Otherwise (in this case) you have to manage the button press stuff manually etc. And (not in this case, just changing a setting) UNDO is working also for free when packing your action within a dialog.

And based on the today's performance of machines we are using the overkill will not be seen/felt.

-----------
I this case you can name the dialog itself 'setta_linea_continua and write the action within the :Ok-action directly without a defun.

Just using your available command in a toolbar is not an option?
Reply With Quote
  #5  
Old 04-06-2008, 11:25 PM
Bobo82 Bobo82 is offline
Registered User
 
Join Date: May 2007
Location: Bologna, Italy
Posts: 22
Re: Creation of button box

Thanks a lot Wolfgang,
the solution of the dialog is certainly the best one.
I realy appreciated yuor suggestion .

Thanks a lot, again.
Reply With Quote
Reply


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

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:01 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.