Buttons on the Drawing AreaButtons on the Drawing AreaRE: Buttons on the Drawing AreaMateusz Dziedzichttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=17480122019-12-09T11:42:33Z2019-12-09T11:41:49ZDear Benedikt,<br />A model type can have only one graphical representation. To display two buttons in a model type you must do this via the GraphRep attribute. The GraphRep code for two different buttons in a model type could look like this:<br /><br />GRAPHREP layer:-3<br /><br />IF (_outdevtype = "drawingarea") {<br />SET printIcon:"db:\\btn_print.png"<br />BITMAPINFO (printIcon)<br />BITMAP (printIcon) x:1cm y:0.5cm w:1.5cm h:1.5cm<br />HOTSPOT "_PrintModel_" text:"Print Model" x:1cm y:0.5cm w:1.5cm h:1.5cm<br />SET printIcon2:"db:\\btn_print.png"<br />BITMAPINFO (printIcon2)<br />BITMAP (printIcon2) x:3cm y:0.5cm w:1.5cm h:1.5cm<br />HOTSPOT "_PrintModel_" text:"Print Model" x:3cm y:0.5cm w:1.5cm h:1.5cm<br />}Mateusz Dziedzic2019-12-09T11:41:49ZRE: Buttons on the Drawing AreaBenedikt Kaiserhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=17300692019-11-14T11:29:07Z2019-11-14T11:29:07ZHello!<br /><br />I am trying to have two different Buttons in the same drawing area. I already created the second button, however, it is not shown in the drawing area. <br />I am pretty sure that I have to do this in Add-ons but unfortunately it is not working.<br /><div class="code"><span class="code-lines">1</span>MODELTYPE "Role Model" from:none plural:"Samples" pos:0 not-simulateable bitmap:"db:\\sample.bmp" graphrep: "First Button GraphRep"from:none plural:"Samples" pos:3 not-simulateable graphrep: "Second Button GraphRep"</div><br />The button with the GraphRep "Second Button GraphRep" is not shown. <br /><br />Best regards,<br /><br />Benedikt KaiserBenedikt Kaiser2019-11-14T11:29:07ZButtons on the Drawing AreaSabin Popescuhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=870492014-03-27T09:13:04Z2014-03-17T13:37:30Z<strong></strong><strong></strong>In this package we provide an example of a model type GraphRep which contains a Button that triggers some event. In our case it is a print-button which opens a print dialogue when ckicking on it:<br /><br /><img src="http://www.adoxx.org/live/documents/10157/86550/print_button_preview.png/06bb267f-27df-409c-a795-f8dc3049b7a0?t=1395134737487" /><br /><strong><br /><br /><span style="font-size: 18px">Downloads</span></strong><br /><br />The files below contain an example library (Print Button.abl) and an example model (Print Button demo model.adl). A step-by-step configuration guide is presented in the Hands-On section below. It completely describes how to build this example library.<br /><br /><a href="http://www.adoxx.org/live/documents/10157/86550/Print+Button.abl/ed93eb1a-dc65-4afe-beac-517409bc148a">Print Button.abl</a><br /><a href="http://www.adoxx.org/live/documents/10157/86550/Print+Button+demo+model.adl/e1dad3a4-1c92-4bcc-b45c-64ff38d87e8d">Print Button demo model.adl</a><br /><br /><br /><span style="font-size: 18px"><strong>Hands-On</strong></span><br /><br /><strong>1) Create new class <em>_</em>_ModelTypeMetaData__<br /><br /><img src="http://www.adoxx.org/live/documents/10157/86550/01_create_class_MTMD.png/c780b827-e1e5-42c3-9827-e5075b86051a?t=1395409899542" /><br /><br /><strong>Steps to create class <em>__ModelTypeMetaData__</em></strong></strong><ul style="list-style: disc inside;"><li>Go to the Library management, select a dynamic library and click <em>Class hierarchy</em>.</li><li>Click <em>View</em> and select <em>Metamodel</em>.</li><li>Select <em>__D-construct__ (Metamodel)</em></li><li>Click <em>New</em> --> <em>New class</em>; name it <em>__ModelTypeMetaData__</em> (two underscore signs!).</li></ul style="list-style: disc inside;"><strong>2) Add new attribute to class __ModelTypeMetaData__</strong><br /><br /><img src="http://www.adoxx.org/live/documents/10157/86550/02_new_attr_for_MTMD.png/2f499720-f5e6-4e89-9b5e-066494ccacfc?t=1395410095527" /><br /><br /><strong>Steps to add attributes to class __ModelTypeMetaData__:</strong><br /><ul style="list-style: disc inside;"><li>Select class <em>__ModelTypeMetaData__</em></li><li>Click <em>New</em> --> <em>New attribute...</em></li><li>Name new attributes and select type according figure above: (1) name: <em>Print Button GraphRep</em>, type: <em>Longstring</em>.</li></ul style="list-style: disc inside;"><strong>3) Configure Print Button GraphRep attribute</strong><br /><br /><img src="http://www.adoxx.org/live/documents/10157/86550/03_conf_print_graphrep.png/2821c022-f35d-4d30-8194-78ca2dd08201?t=1395410409307" /><br /><ul style="list-style: disc inside;"><li>Double click <em>Print Button GraphRep</em> attribute, set <em>Standard value</em> to:</li></ul style="list-style: disc inside;"><div class="code"><span class="code-lines">1</span>GRAPHREP layer:-3<br /><span class="code-lines">2</span>IF (_outdevtype = "drawingarea") {<br /><span class="code-lines">3</span>SET printIcon:"db:\\btn_print.png"<br /><span class="code-lines">4</span>BITMAPINFO (printIcon)<br /><span class="code-lines">5</span>BITMAP (printIcon) x:1cm y:0.5cm w:1.5cm h:1.5cm<br /><span class="code-lines">6</span>HOTSPOT "_PrintModel_" text:"Print Model" x:1cm y:0.5cm w:1.5cm h:1.5cm<br /><span class="code-lines">7</span>}<br /></div><ul style="list-style: disc inside;"><li>Make sure that the file btn_print.png is contained in the database (close the <em>Library management</em> and go to <em>Extras</em> --> <em>File management…</em>).</li></ul style="list-style: disc inside;"><strong>4) Creating _PrintModel_ attribute (Programcall)</strong><br /><br /><img src="http://www.adoxx.org/live/documents/10157/86550/04_create_print_programcall.png/07c837e5-f978-4dae-89ab-ca37a1d24872?t=1395410630713" /><br /><ul style="list-style: disc inside;"><li>Select class <em>__ModelTypeMetaData__</em></li><li>Click <em>New</em> --> <em>New attribute...</em></li><li>Name new attributes and select type according figure above: (1) name: <em>_PrintModel_</em>, type: <em>Programcall</em>.</li></ul style="list-style: disc inside;"><strong>5) Configure _PrintModel_ attribute (Programcall)</strong><br /><br /><img src="http://www.adoxx.org/live/documents/10157/86550/05_conf_programcall.png/c4cb2a3f-5e05-45ac-a16a-d9a1887c056a?t=1395410889740" /><br /><ul style="list-style: disc inside;"><li>Double click <em>_PrintModel_</em> attribute</li><li>Set <em>Standard value</em> to: <em>Print Model</em></li><li>•Click <em>Facets</em> and set <em>EnumerationDomain</em> to:</li></ul style="list-style: disc inside;"><div class="code"><span class="code-lines">1</span>ITEM "Print Model"<br /><span class="code-lines">2</span>EXECUTE file: ("db:\\PrintModel.asc")<br /></div><ul style="list-style: disc inside;"><li>Make sure that the file <em>PrintModel.asc</em> is contained in the database.</li></ul style="list-style: disc inside;"><strong>6) Define Model type</strong><br /><br /><img src="http://www.adoxx.org/live/documents/10157/86550/06_define_MT.png/cbf80bf0-c866-459c-9858-537e276c2bb5?t=1395411139017" /><br /><br /><ul style="list-style: disc inside;"><li>Go back to the <em>Library management</em> and select your current <em>Dynamic Library</em>.</li><li>Click <em>Library attributes…</em> --> <em>Add-ons</em> and define the following model type according the figure above:</li></ul style="list-style: disc inside;"><div class="code"><span class="code-lines">1</span>MODELTYPE "Print Button Sample" from:none plural:"Samples" pos:0 not-simulateable bitmap:"db:\\sample.bmp" graphrep: "Print Button GraphRep"</div><strong><span style="font-size: 18px"><br /><br />Result</span></strong><br /><br />In order to see the result, open <a href="http://www.adoxx.org/live/documents/10157/86550/Print+Button+demo+model.adl/e1dad3a4-1c92-4bcc-b45c-64ff38d87e8d">Print Button demo model.adl</a> in the ADOxx Modeling Toolkit. <br /><br /><img src="http://www.adoxx.org/live/documents/10157/86550/print_button_preview.png/06bb267f-27df-409c-a795-f8dc3049b7a0?t=1395135328900" /><br /><ul style="list-style: disc inside;"><li>Clicking the <em>Print Model</em> button triggers (via <em>HOTSPOT</em> command) the Programcall <em>_PrintModel_</em>, which executes the file <em>PrintModel.asc</em>.</li><li>Note, that the print icon (<em>btn_print.png</em>) is represented on the drawing area only.</li></ul style="list-style: disc inside;"><strong></strong>Sabin Popescu2014-03-17T13:37:30Z