Jump to content
Developer Wiki and Function Reference Links ×

Custom Dialogs: Making options show/hide


SamIWas

Recommended Posts

Me again...sorry for flooding the forum, but I'm on a writing kick...

 

So, in custom PIOs, it's easy to show/hide/grey etc different parameters in the OIP.

 

I assume the same thing is possible in custom dialogs, as things like the door tool change options in the dialog depending on what is in other fields.  I'm looking to replicate that, but fear that it may be event-based or something, and I just can't wrap my head around that yet.

 

I was hoping that a simple if/then statement would do it, but it appears to be more complicated than that, since I don't think it parses the field results until the OK button is hit.  Any pointers, or is this far more complicated than that?

In the handler section....
			SetupDialogC:
				BEGIN
					AddChoice(dialogid,7,'Angle',0);
					AddChoice(dialogid,7,'Distance',1);
					SetItemText(dialogid,9,GetLName(ActLayer));
					FOR symindex:= 1 to numsyms DO symindex:= InsertImagePopupResource(dialogid, 5, symlist, symindex);
				END;

In the dialog section....


		dialogid:=CreateLayout('Place Fixtures On Radius',TRUE,'Apply','Cancel');
		CreateStaticText(dialogid,4,'Select Symbol:',15);
		CreateThumbnailPopup(dialogid,5);
		CreateStaticText(dialogid,6,'Mode:',15);
		CreatePulldownMenu(dialogid,7,20);
		CreateStaticText(dialogid,8,'Relative Angle:',15);
		CreateEditReal(dialogid,9,2,0,10);
		CreateStaticText(dialogid,10,'Length:',15);
		CreateEditReal(dialogid,11,3,72,10);
		
		

		SetFirstLayoutItem(dialogid,4);
		SetRightItem(dialogid,4,5,0,0);
		SetBelowItem(dialogid,4,6,0,0);
		SetRightItem(dialogid,6,7,0,0);
		GetSelectedChoiceInfo(dialogid,7,0,lindex,lmode);
		IF lmode='Angle' THEN BEGIN
			SetBelowItem(dialogid,6,8,0,0);
			SetRightItem(dialogid,8,9,0,0);
			END;
		IF lmode='Distance' THEN BEGIN
			SetBelowItem(dialogid,8,10,0,0);
			SetRightItem(dialogid,10,11,0,0);
			END;

 

Link to comment
12 hours ago, JBenghiat said:

You can’t change the layout live, only hide, show, and disable items. You place your if/then in the dialog handler, where you can retrieve values and call ShowItem(). You can retrieve a value at any time in the handler loop, not just during the ok event. 

 

12 hours ago, klinzey said:

Typically you will use Swap Panes  to show different sets of controls depending on the options that are chosen in the dialog.

This will give let you place different controls in the same location.

https://developer.vectorworks.net/index.php/VS:CreateSwapPane

 

Oooh...thanks guys, I will test these out.  I don't think the script I'm trying to write will work out because I'm not sure you can pull info from the underlying polygon/arc in a lighting pipe.  But, this still gives me some stuff to play with.

Link to comment
3 hours ago, JBenghiat said:


You can… but what are you trying to do? A solution may already exist. 

 

Building a script where I can right click on a pipe, choose a fixture, then have the script place fixtures on the pipe at either a fixed distance or per specified degree along the curve of a curved pipe.  There are options between duplicate array, move by points, or align and distribute, but I don't believe any of them allows you to pick a pipe and a fixture and automatically distribute.    I know how to do all the aligning and placing, I can figure out the length and radius of pipes and feed them in, but following paths is the harder part.

 

For instance, when using a curved lighting pipe, it's fairly straightforward to get the length and radius of the pipe (although dimension fields come in with very strange formatting), but there's nothing in the pipe records which indicate the starting and ending angle of the pipe, it's center of arc, or rotation, at least as far as I can find.  So, I figure I need to pull in the underlying arc to get its information.

Link to comment

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.

×
×
  • Create New...