B.Balemi Posted April 17, 2004 Share Posted April 17, 2004 Hi Everyone Have enjoyed my journey into the world of creating my own dialogs for a PIO. At present have worked on a drop down menu that gives you a 4 -5 numbers of setting changes dialogs otherwise the PIO Palette is as tall as Everest. My problem is that now that I can call these dialogs and the changes take place it doesnt change my default value. eg SetEditReal() I thought would do this . the changes take place on screen but if you call the dilaog back the default values in the Create EditReal() are still there . I guess eveytime you call the dialog it calls the layout then the driver routine follows . I want the driver to change the layout default . I thought SetEditReal() would do this . Anyone with suggestions .Thanks Brendan VWA/RW, WinXP, P41600MHz512Ram, 64Video Quote Link to comment
ccroft Posted April 18, 2004 Share Posted April 18, 2004 If I understand you correctly, there's no way to do what you want.I think the only way to set new defaults is to manually go into "create plugin" and change them. That and the first time you place the object in a new doc you get to set them. One option is to create a symbol of the plugin with the needed defaults.Under options you can have it placed as a plugin with all it's editable parameters intact. You can access them from the object browser.This set-up works well for me. I have a dozen or so configurations of the same PIO saved like this in a template. There are some scripts at Vectordepot to help with managing PIO's.Clone plugin comes to mind. (edit) Looks like I misunderstood. I thought you were talking about the parameter list that comes up when you first place the PIO.That's what I get for posting before the coffee kicks in.....I don't know how to make a script edit itself. Sorry. [ 04-18-2004, 02:59 PM: Message edited by: ccroft ] Quote Link to comment
B.Balemi Posted April 18, 2004 Author Share Posted April 18, 2004 Thanks for the post anyway . Am wondering whether I have to Putfile and place somewhere outside the doc to draw from later? Brendan Quote Link to comment
ccroft Posted April 20, 2004 Share Posted April 20, 2004 If what you want is to call one of 4 or 5 configurations of a PIO that has....I don't know.....50 to 100 parameters, you still may want to think about the Object Browser approach.It's a snapshot maker. Or perhaps you might consider simplifying the PIO by splitting it up into 4 or 5 tools and defining some of the parameters as constants within each. I'm in the cabinet trade.I could write a PIO called "make kitchen" that would have hundreds of parms.Or I could do as v-works does and break that up into 3 or 4 PIO's.In fact (for me anyway) it's much more usable to break that down further to more PIO's with less parms each .It seems that you may be in a similar situation,but I'm only guessing. In my case,deciding where this optimum division is has been the subtlest part of the process. On the other hand, you could write info in and out of the PIO. If you have access to v-works 8.5 (before encryption) you can find examples of this in the plugins folder.Hexbolts is one. Hope I'm not explaing the obvious,but I think these kinds of questions are where the real fun of scripting lies....strategy/design. Best of luck. Charles Quote Link to comment
B.Balemi Posted April 20, 2004 Author Share Posted April 20, 2004 Thanks for the interesting idaes Charles .All input is good because it stimulates u to attack from other angles . Not exactly sure what u mean about the Snapshot maker ability of the object browser? An example of the custom settings I am wanting to change is the attributes of the components so as I have full control of the finished look of the PIO. Instead of having 8 Classes in the Parameter list I thought of tucking it into a menu call. Things like these can keep Your PIO interface simple if u want it but to have full control of the object. Regards Brendan Quote Link to comment
ccroft Posted April 21, 2004 Share Posted April 21, 2004 Well,8 classes in a drop-down menu in a PIO is far from unheard of. A lot of the stock PIO's do this.A lot simpler than anything else. Snap-shot......I only found out about this a year ago,and I would assume it will capture your class assignments as well. Insert a PIO in a drawing and configure it. Select it and choose "create symbol" from the menu. Do the usual stuff and then hit options. Select "convert to plugin"(or something like that) You end up with a red icon in object browser,signalling that it will be inserted as a PIO. It will come in with the same settings you had when you created it and it will be fully editable just as if you had placed it with the tool. So it sort of saves a snapshot of a config of a PIO. I find this feature to be very useful.It can save a lot of parameter re-setting.The browser will also display whatever you choose to call the "symbol",making it even easier to understand what you're choosing to place. Fool around with it a bit. (edit) It occurs to me that you may be talking about a menu command or tool, and not a Plug-in Object......that would change everything! [ 04-20-2004, 10:34 PM: Message edited by: ccroft ] Quote Link to comment
kiwi Posted April 27, 2004 Share Posted April 27, 2004 Hi Balemi.... Busy lately, and not with what you was thinking! You may want to set different dialog sub ruttiness and call them from the main one. A bit like sub dialogs... I never try that, but the manual says is possible! You can call a small subdialog, or a function like GetInteger() when you set your "run dialog" procedure and set your dialog menus in function your integer. Your SetEditReal only work when you set your dialog, but nothing stop you to have a diferent set dialog procedures, and call the one you need when before run your dialog and set the display values: this could be the best option for you. Will work a bit this one on the next days and try to come up with an example. Cheers, Quote Link to comment
Bmb@GMB Posted April 27, 2004 Share Posted April 27, 2004 IsNewCustomObject I thought may work. Have set up a record that relates to the Dialog . This is good for after object creation then can load dialog from Record . The above function I Am trying to set up is before object creation. Maybe two Dialog setups in the layout routine . Good to here youre voice mate Go the Chiefs. Brendan Quote Link to comment
kiwi Posted April 27, 2004 Share Posted April 27, 2004 he...he! I spend a couple of min modifying one of my classics... dedicate to you Balemi (note that I'm not sure the rest of the script works... I just tested the dialogs). You see the final dialog being in function of the first selection... I hope that's what you was after. Good luck to see the variables... but the one you are after is the BalemiIndex, that runs one of the two Define or drive procedures. They are probably more elegant ways to do that... but he works! I never done a PIO, and is little I can help with those. code: {/////////////////////////////////////////////////////////////// LayerClassT By: <Kiwi Dec 2003> For: <Balemi> Built with Dialog Builder 4 © 2001 Nemetschek North America. ///////////////////////////////////////////////////////////////} PROCEDURE LayerClassT; VAR dlogID,dlogResult,nl,nc,i : INTEGER; dialogIsOK,rsrcOK,dupl,go,dumm,OK, BalemiIndex : BOOLEAN; h,ho: HANDLE; Layerr,classr,currentL,currentC: STRING; Layers,Classes: DYNARRAY OF STRING; { dialog related subroutines } { Dialog definition function subroutine } FUNCTION Define_LayerClassT1 : INTEGER; VAR dialogID : INTEGER; BEGIN dialogID := CreateLayout('Layer/Class Transfer',True,'OK','Cancel'); CreatePulldownMenu(dialogID,10,25); CreateCheckBox(dialogID,30,'Follow objects'); CreateCheckBox(dialogID,40,'duplicate objects'); SetFirstLayoutItem(dialogID,10); SetBelowItem(dialogID,10,30,0,0); SetBelowItem(dialogID,30,40,0,0); SetHelpString(1,'Accepts dialog data.'); SetHelpString(2,'Cancels operation without changes.'); SetHelpString(10,'Slect a layer to transfer your selected object'); SetHelpString(30,'Go to the selected option with the actual visibility settings'); SetHelpString(40,'Select to duplicate your selected object'); Define_LayerClassT1 := dialogID; END; FUNCTION Define_LayerClassT2 : INTEGER; VAR dialogID : INTEGER; BEGIN dialogID := CreateLayout('Layer/Class Transfer',True,'OK','Cancel'); CreatePulldownMenu(dialogID,20,25); CreateCheckBox(dialogID,30,'Follow objects'); CreateCheckBox(dialogID,40,'duplicate objects'); SetFirstLayoutItem(dialogID,20); SetBelowItem(dialogID,20,30,0,0); SetBelowItem(dialogID,30,40,0,0); SetHelpString(1,'Accepts dialog data.'); SetHelpString(2,'Cancels operation without changes.'); SetHelpString(20,'Select the class you want your object transfer to.'); SetHelpString(30,'Go to the selected option with the actual visibility settings'); SetHelpString(40,'Select to duplicate your selected object'); Define_LayerClassT2 := dialogID; END; { get Layer names to dinarray Layers } Procedure GetLayers; BEGIN nl:=NumLayers; AlLOCATE Layers[1..nl]; h:=FLayer; For i:=1 TO nl DO BEGIN Layers:=GetLNAME(h); h:=NextLAyer(h); END; END; { get Class names to dinarray Classes } Procedure GetClasses; BEGIN nc:=ClassNum; AlLOCATE Classes[1..nc]; For i:=1 TO nc DO BEGIN Classes:=ClassList(i); END; END; { Change each obj settings } Procedure ChangeObject(ho:HANDLE); BEGIN h:=GetLayerByName(layerr); SetClass(ho,classr); dumm:=SetParent(ho,h); END; { Dialog driver function subroutine 1 } PROCEDURE Drive_LayerClassT1(VAR item:LONGINT; data:LONGINT); BEGIN CASE item OF SetupDialogC:BEGIN GetLayers; h:=ActLayer; CurrentL:=GetLNAme(h); FOR i:=1 to nl DO BEGIN InsertChoice(10,i-1,Layers); IF Layers=CurrentL THEN SELChoice(10,i,true); END; OK:=TRUE; END; 1:BEGIN GetSelChoice(10,0,i,Layerr); dupl:=ItemSel(40); go:=ItemSel(30); END; END; END; { Dialog driver function subroutine 2 } PROCEDURE Drive_LayerClassT2(VAR item:LONGINT; data:LONGINT); BEGIN CASE item OF SetupDialogC:BEGIN GetClasses; CurrentC:=ActiveClass; For i:=1 TO nc DO BEGIN InsertChoice(20,i-1,Classes); IF ClassList(i)=CurrentC THEN BEGIN SELChoice(20,i,true); END; END; OK:=TRUE; END; 1:BEGIN GetSelChoice(20,0,i,Classr); dupl:=ItemSel(40); go:=ItemSel(30); END; END; END; { main body of script } BEGIN BalemiIndex:= YNDialog ('Yes: layers, No: classes'); If BalemiIndex THEN dlogID := Define_LayerClassT1 ELSE dlogID := Define_LayerClassT2; dialogIsOK := VerifyLayout(dlogID); IF dialogIsOK THEN BEGIN If BalemiIndex THEN dlogResult:= RunLayoutDialog(dlogID,Drive_LayerClassT1); If NOT BalemiIndex THEN dlogResult:= RunLayoutDialog(dlogID,Drive_LayerClassT2); END; IF dupl THEN duplicate(0,0); IF OK THEN ForEachObject(ChangeObject,SEL=true); IF go THEN BEGIN NameClass(Classr); Layer(layerr); END ELSE BEGIN Layer(CurrentL); NameClass(CurrentC); END; END; Run(LayerClassT); [/code] Quote Link to comment
Recommended Posts
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.