Jump to content
Sign in to follow this  
arthur&l?on

CreatePushButton

Recommended Posts

Hello.

I haven't scripted for some years and never used a lot modern dialogs. I try to know how Pushbuttons work.. in fact, what happens when the user clicks on such a thing ? What happens and how to retrieve data passed, what kind of data and how to use it ?

If someone can help, many thanks in advance

Francesco

Share this post


Link to post

Francesco,

After just getting my head around dialogs I can say it was an interesting experience.

http://techboard.nemetschek.net/ubbthreads.php?ubb=showflat&Main=30918&Number=151961#Post151961

This is a topic which we only finished days ago.

There are also plenty of resources to view under resources and examples at the Vectorworks homepage, have a look at these for various structures.

As for what actually happens my comprehension is easiest understood in three parts. First is the layout section which deals with the physical layout of the dialog. The second is the handler which retains the data when the ok/cancel/anything button is pressed and then is used to save appropriate data to Variables, Strings and Booleans. The third is the run component which is what you will do with the newly saved components, make a table, make a rectangle, etc.

If none of that makes sense feel free to chip in anyone.

J

Edited by James Russell

Share this post


Link to post
Francesco]

... The second is the handler which retains the data when the ok/cancel/anything button is pressed and then is used to save appropriate data to Variables, Strings and Booleans. ...

True, but you can also adjust the dialog in this part. So it's not only to save the output but also to change the data in the dialog or the layout of the dialog.

Share this post


Link to post

Francesco,

???Every item in a modern dialog has an ID number. When a user clicks on, or types into one of the items, the Modern Dialog "machinery" senses which item was invoked and passes the item's ID number to a routine that you have to write. That procedure will usually have a case statement inside with one case item for every active dialog item ID. You tell the Modern Dialog "machinery" what that procedure is with the RunLayoutDialog() command.

???If your button has an ID of "10", then you will have to write code inside the case statement, for item = 10, to tell your program what to do when it gets pressed. Here's a sample routine for doing something for ITEM 10, which you defined with your CreatePushButton call.

PROCEDURE Dialog_Handler(var item :LONGINT; data :LONGINT);

Begin

???case item of

??????10: begin

?????????{ Do your thing here }

??????end;??????{ 10 }

???end;??????{ case }

End;??????{ Dialog_Handler }

There are many short examples in the VectorScript Function Reference. Check out "CreatePullDownMenu" and "CreateColorPopup" for some short examples that work. Also check online at http://developer.vectorworks.net/index.php?title=Main_Page

Write back when you have more questions.

HTH,

Raymond

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...