[Em...] Posted August 18, 2021 Share Posted August 18, 2021 Hi, I am looking to build a dialog box with a Selection element widget that acts the same as the dropdown menu in the create Element Group function. The solutions I am particularly interested in, is: how to implement --- Insert currently selected elements --- from selected elements in the Element Explorer, and how to implement --- Remove entry --- Thank you. Kind regards, Emil. Link to comment Share on other sites More sharing options...
[Th...] Posted September 13, 2021 Share Posted September 13, 2021 You can find some documentation about your request here https://connect.gom.com/x/DZ-VAg at point "2.3.13 Selection element widget". The script snippet you are looking for could be something like: # -*- coding: utf-8 -*- import gom DIALOG=gom.script.sys.create_user_defined_dialog (content='<dialog>' \ ' <title>Create Element Group</title>' \ ' <style></style>' \ ' <control id="OkCancel"/>' \ ' <position></position>' \ ' <embedding></embedding>' \ ' <sizemode></sizemode>' \ ' <size height="146" width="244"/>' \ ' <content columns="2" rows="2">' \ ' <widget row="0" column="0" rowspan="1" type="label" columnspan="1">' \ ' <name>name_lbl</name>' \ ' <tooltip></tooltip>' \ ' <text>Name</text>' \ ' <word_wrap>false</word_wrap>' \ ' </widget>' \ ' <widget row="0" column="1" rowspan="1" type="input::string" columnspan="1">' \ ' <name>name_w</name>' \ ' <tooltip></tooltip>' \ ' <value>Group</value>' \ ' <read_only>false</read_only>' \ ' <password>false</password>' \ ' </widget>' \ ' <widget row="1" column="0" rowspan="1" type="label" columnspan="1">' \ ' <name>element_lbl</name>' \ ' <tooltip></tooltip>' \ ' <text>Elements</text>' \ ' <word_wrap>false</word_wrap>' \ ' </widget>' \ ' <widget row="1" column="1" rowspan="1" type="input::point3d" columnspan="1">' \ ' <name>element_w</name>' \ ' <tooltip></tooltip>' \ ' <supplier>custom</supplier>' \ ' </widget>' \ ' </content>' \ '</dialog>') # # Event handler function called if anything happens inside of the dialog # def dialog_event_handler (widget): pass # # Element filter function called for all elements to check which ones should be provided for selection in the widget # def dialog_element_filter (element): try: return element.is_selected except: pass return False DIALOG.handler = dialog_event_handler DIALOG.element_w.filter = dialog_element_filter RESULT=gom.script.sys.show_user_defined_dialog (dialog=DIALOG) Link to comment Share on other sites More sharing options...
[Ma...] Posted December 19, 2023 Share Posted December 19, 2023 The documentation has been moved to User-defined Dialogs — Dialog widgets — Specific widgets — Selection element widget now. Link to comment Share on other sites More sharing options...
[ff...] Posted January 5 Share Posted January 5 (edited) Please sign in to view this quote. This is super useful- thanks for posting it wish i would have seen it earlier Edited January 5 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in