SamIWas Posted January 15, 2022 Share Posted January 15, 2022 Hey gurus... I wrote a script to place symbols (lighting devices) based on the position of a large container object and all of its settings. It all works exactly how I want it to. Right now, I'm using a couple of workarounds to get the correct final result, but I'd love to figure out a few sticking points.One is getting a symbol chooser in my dialog, and the other is how to populate the layer drop-down with the current layer. Some notes are in the code below (only relevant parts of the entire code are shown). I realize that it might not be up to real programmers type code. So, I thought CreateSymDispCtrlN or CreateSymbolDisplayControl might be the answer, but they display only images. I would like to get the symbol drop-down menu seen in other tools and then be able to pass off the resulting symbol choice to the lsymbol variable. The second issue is the layer dialog. Choosing the layer and passing it to the llayer variable works fine and functions correctly in the script. I just want the menu to default to the current layer, but doing a SetItemText for that component caused weird issues with selecting, so I'm not sure that's it. Any pointers would be very appreciated! FUNCTION Mydialog(var lsymbol:STRING; var langle : REAL; var llayer : STRING ) : BOOLEAN; LABEL 99; VAR dialogid, result : INTEGER; iTest : REAL; PROCEDURE Dialog_Handler(VAR item : LONGINT; data : LONGINT); BEGIN CASE item OF SetupDialogC: BEGIN ***DOES SOMETHING NEED TO GO HERE TO POPULATE THE SYMBOL DIALOG??*** ***I THINK SOMETHING NEEDS TO GO HERE TO POPULATE THE DEFAULT FOR THE LAYER DIALOG*** END; 1: BEGIN GetItemText(dialogid,5,lsymbol); ** THIS IS TEMPORARY UNTIL I CAN FIGURE OUT THE SYMBOL DIALOG AND HOW OT PASS THE RESULT IF GetEditReal(dialogid,7,2,iTest) THEN langle:=iTest; GetItemText(dialogid,9,llayer); END; 2: BEGIN END; END; {case} END; {Dialog Handler} BEGIN dialogid:=CreateLayout('Add Fixtures to Softboxes',TRUE,'Apply','Cancel'); CreateStaticText(dialogid,4,'Symbol Name',20); {CreateSymDispCtrlN(dialogid,5,'Arri SkyPanel S60-c',100,100,5,0,2,1,TRUE);} *** TRIED THE ABOVE AND CreateSymbolDisplayControl, BOTH OF WHICH SHOW ONLY AN ICON, NO MENU CreateEditText(dialogid,5,'Enter symbol here',40); *** THIS IS TEMPORARY UNTIL I CAN FIGURE OUT THE SYMBOL DIALOG CreateStaticText(dialogid,6,'Relative Angle:',20); CreateEditReal(dialogid,7,2,0,10); CreateStaticText(dialogid,8,'Layer:',20); CreateLayerPDMenu(dialogid,9,40); SetFirstLayoutItem(dialogid,4); SetRightItem(dialogid,4,5,0,0); SetBelowItem(dialogid,4,6,0,0); SetRightItem(dialogid,6,7,0,0); SetBelowItem(dialogid,6,8,0,0); SetRightItem(dialogid,8,9,0,0); Quote Link to comment
MullinRJ Posted January 16, 2022 Share Posted January 16, 2022 (edited) Hello @SamIWas, For your symbol popup item, look at: CreateThumbnailPopup(dialogID, item_number); Sorry, I don't have any example code to populate it. I assume your LayerName popup menu is already populated, but if not, use: GetChoiceCount(dialogID, menuID, Cnt);AddChoice(dialogID, menuID, 'menu item text', Cnt); in a loop to add items to the end of the menu. This code would go in the SetupDialogC section of the dialog handler. To select an existing menu item to be the chosen item, use: SelectChoice(dialogID, menuID, menuPos, TRUE); where menuPos is the position of the Active Layer Name in your list. I believe counting in SelectChoice is 1-based, but if I'm wrong, it's 0-based. Easy enough to test. This code also goes in the SetupDialogC section of the dialog handler. HTH, Raymond Edited January 16, 2022 by MullinRJ replace custom call with generic call Quote Link to comment
MullinRJ Posted January 16, 2022 Share Posted January 16, 2022 @SamIWas, After a little playing, I found one way to populate a Symbol Popup Menu: index := InsertImagePopupObjectItem(dialogid, menuID, SymNam); And it appears you can also use: index := InsertImagePopupResource(dialogID, kImagePopupID, listID, index); where you use one of the BuildResourceList commands to build a list of symbol definition names, though I haven't tried this explicitly. Have fun, Raymond Quote Link to comment
SamIWas Posted January 16, 2022 Author Share Posted January 16, 2022 8 hours ago, MullinRJ said: Hello @SamIWas, For your symbol popup item, look at: CreateThumbnailPopup(dialogID, item_number); Sorry, I don't have any example code to populate it. I assume your LayerName popup menu is already populated, but if not, use: GetChoiceCount(dialogID, menuID, Cnt);AddChoice(dialogID, menuID, 'menu item text', Cnt); in a loop to add items to the end of the menu. This code would go in the SetupDialogC section of the dialog handler. To select an existing menu item to be the chosen item, use: SelectChoice(dialogID, menuID, menuPos, TRUE); where menuPos is the position of the Active Layer Name in your list. I believe counting in SelectChoice is 1-based, but if I'm wrong, it's 0-based. Easy enough to test. This code also goes in the SetupDialogC section of the dialog handler. HTH, Raymond Thanks...this has given me some stuff to look at. The SelectChoice for the layer menu works better than what I had come up with. It appears that it orders the list in alphabetical order, so now I'm just searching for the right way to find the alphabetical index of the layers. Man...the symbol stuff seems harder than I thought. Figured there would be a symbol popup window like what appears in so many tools, but it looks like you have to build it. ugh. Quote Link to comment
SamIWas Posted January 16, 2022 Author Share Posted January 16, 2022 9 hours ago, MullinRJ said: @SamIWas, After a little playing, I found one way to populate a Symbol Popup Menu: index := InsertImagePopupObjectItem(dialogid, menuID, SymNam); And it appears you can also use: index := InsertImagePopupResource(dialogID, kImagePopupID, listID, index); where you use one of the BuildResourceList commands to build a list of symbol definition names, though I haven't tried this explicitly. Have fun, Raymond Alright...I was able to get this to work well enough for now. Can't figure out how to make it show only lighting devices, so in bigger documents, the list is huge. But, it's at least a start. What I was hoping for is something like this, but maybe it's not possible. Thanks for the help so far! Quote Link to comment
MullinRJ Posted January 16, 2022 Share Posted January 16, 2022 1 hour ago, SamIWas said: What I was hoping for is something like this, but maybe it's not possible. I believe that exceeds the scope of your original question. More programming will be required. Much more. Raymond 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.