<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Picture boxes or canvas tools in Dialogs? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279203#M2145</link>
    <description>Thank you very much Viktor Kovacs! I owe you a coffee-beer-pizza, if you have a buymeacoffe account I will send you a coffee.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt;  &lt;BR /&gt;
I was thinking about buying the Developer Support for a year. Where can I find some information about the  services included in this subscription from GRAPHISOFT?</description>
    <pubDate>Tue, 29 Jun 2021 07:19:24 GMT</pubDate>
    <dc:creator>Mihalcea Bogdan</dc:creator>
    <dc:date>2021-06-29T07:19:24Z</dc:date>
    <item>
      <title>Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279199#M2141</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello!&lt;BR /&gt;Which part of the API Reference I need to read about picture boxes?&lt;BR /&gt;Is there any "canvas" like elements for Archicad?&lt;BR /&gt;I really need a picture container or an canvas container where I can display and interact a .PNG, or a .SVG file.&lt;BR /&gt;After some user input is made, the AddOn will create a query on a database(online) which will result in an image, after that i need to update that image and so on ...&lt;BR /&gt;&lt;BR /&gt;Is there any possibility to actually draw on the Dialog box?&lt;BR /&gt;&lt;BR /&gt;I attached a picture where I would like to have a picture box or a canvas element so you can have an ideea. .&lt;BR /&gt;A C# example: &lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Sep 2021 07:31:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279199#M2141</guid>
      <dc:creator>Mihalcea Bogdan</dc:creator>
      <dc:date>2021-09-14T07:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279200#M2142</link>
      <description>It is possible with &lt;B&gt;DG::UserItem&lt;/B&gt;. Create one in your dialog, and than use &lt;B&gt;NewDisplay::UserItemUpdateNativeContext&lt;/B&gt; to draw on it in the &lt;B&gt;UserItemUpdate &lt;/B&gt;event.</description>
      <pubDate>Mon, 28 Jun 2021 16:50:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279200#M2142</guid>
      <dc:creator>Viktor Kovacs</dc:creator>
      <dc:date>2021-06-28T16:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279201#M2143</link>
      <description>Thanks for the fast reply. &lt;BR /&gt;
Can you point me where I can find some documentation/help on DG::UserItem? &lt;BR /&gt;
&lt;BR /&gt;
  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_eek.gif" style="display : inline;" /&gt;</description>
      <pubDate>Mon, 28 Jun 2021 21:39:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279201#M2143</guid>
      <dc:creator>Mihalcea Bogdan</dc:creator>
      <dc:date>2021-06-28T21:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279202#M2144</link>
      <description>Unfortunately there is no easy example among the example add-ons, but here are the basics.&lt;BR /&gt;
&lt;BR /&gt;
1. Define a user item in the grc:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;/* [ 1] */ UserItem			  100 100  50 50	ClientEdge
&lt;/PRE&gt;

&lt;BR /&gt;
2. Initialize it in the dialog constructor:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;myUserItem (GetReference (), MyUserItemID)
&lt;/PRE&gt;

&lt;BR /&gt;
3. Attach to event listener.&lt;BR /&gt;
&lt;BR /&gt;
4. Implement the UserItemUpdate function.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;void MyDialog::UserItemUpdate (const DG::UserItemUpdateEvent&amp;amp; ev)
{
	NewDisplay::UserItemUpdateNativeContext context (ev);
	// ...
	context.DrawImage (image, width, height, 0.0f, 0.0f, 0.0f, false);
	// ...
}
&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Jun 2021 05:56:19 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279202#M2144</guid>
      <dc:creator>Viktor Kovacs</dc:creator>
      <dc:date>2021-06-29T05:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279203#M2145</link>
      <description>Thank you very much Viktor Kovacs! I owe you a coffee-beer-pizza, if you have a buymeacoffe account I will send you a coffee.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt;  &lt;BR /&gt;
I was thinking about buying the Developer Support for a year. Where can I find some information about the  services included in this subscription from GRAPHISOFT?</description>
      <pubDate>Tue, 29 Jun 2021 07:19:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279203#M2145</guid>
      <dc:creator>Mihalcea Bogdan</dc:creator>
      <dc:date>2021-06-29T07:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279204#M2146</link>
      <description>&lt;BLOCKQUOTE&gt;Viktor wrote:&lt;BR /&gt;
Unfortunately there is no easy example among the example add-ons, but here are the basics.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;void MyDialog::UserItemUpdate (const DG::UserItemUpdateEvent&amp;amp; ev)
{
	NewDisplay::UserItemUpdateNativeContext context (ev);
	// ...
	context.DrawImage (image, width, height, 0.0f, 0.0f, 0.0f, false);
	// ...
}
&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
If someone arrives to this post and does not know where the UserItemUpdateNativeContext is located it is here: &lt;B&gt;AC_DEV_KIT_PATH\Support\Modules\DGGraphix&lt;/B&gt;</description>
      <pubDate>Tue, 29 Jun 2021 07:57:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279204#M2146</guid>
      <dc:creator>Mihalcea Bogdan</dc:creator>
      <dc:date>2021-06-29T07:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279205#M2147</link>
      <description>&lt;BLOCKQUOTE&gt;Mihalcea wrote:&lt;BR /&gt;
I was thinking about buying the Developer Support for a year. Where can I find some information about the  services included in this subscription from GRAPHISOFT?
&lt;/BLOCKQUOTE&gt;

Hi Michalcea,&lt;BR /&gt;
&lt;BR /&gt;
The subscription includes a "priority lane" via the official support channel &lt;A href="https://graphisoft.atlassian.net/servicedesk/customer/portal/5" target="_blank"&gt;&lt;/A&gt;&lt;S&gt;&lt;A href="https://graphisoft.atlassian.net/servicedesk/customer/portal/5" target="_blank"&gt;&lt;/A&gt;&lt;A href="&amp;lt;/s&amp;gt;&amp;lt;LINK_TEXT text=&amp;quot;https://graphisoft.atlassian.net/servic ... r/portal/5&amp;quot;&amp;gt;https://graphisoft.atlassian.net/servicedesk/customer/portal/5&amp;lt;/LINK_TEXT&amp;gt;&amp;lt;e&amp;gt;"&gt;&lt;/A&gt;&lt;/S&gt;&lt;LINK_TEXT text="https://graphisoft.atlassian.net/servic ... r/portal/5"&gt;https://graphisoft.atlassian.net/servicedesk/customer/portal/5&lt;/LINK_TEXT&gt;&lt;E&gt;&lt;/E&gt;, meaning that we guarantee a short, 72 hour feedback to your questions.&lt;BR /&gt;
&lt;BR /&gt;
Best, Akos</description>
      <pubDate>Tue, 29 Jun 2021 09:19:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279205#M2147</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2021-06-29T09:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279206#M2148</link>
      <description>Thank you!&lt;BR /&gt;
I will think about this service!</description>
      <pubDate>Tue, 29 Jun 2021 11:16:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279206#M2148</guid>
      <dc:creator>Mihalcea Bogdan</dc:creator>
      <dc:date>2021-06-29T11:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279207#M2149</link>
      <description>&lt;BLOCKQUOTE&gt;Viktor wrote:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;void MyDialog::UserItemUpdate (const DG::UserItemUpdateEvent&amp;amp; ev)
{
	NewDisplay::UserItemUpdateNativeContext context (ev);
	// ...
	context.DrawImage (image, width, height, 0.0f, 0.0f, 0.0f, false);
	// ...
}
&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
This code works only &lt;B&gt;inside&lt;/B&gt; the &lt;B&gt;"UserItemUpdate"&lt;/B&gt; function when the UserItem updates. I am having a real hard time figuring out how to pass this &lt;B&gt;context&lt;/B&gt; to a function like 
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;virtual void UserItemClicked(const DGUserItemClickEvent &amp;amp;ev)
{
	//draw something when user clicks
}
virtual void SpecDragStarting(const ItemDragSourceEvent &amp;amp;ev)
{
	//do something when user starts dragging like fetch an image from Google Earth based on the new coordinates
}
&lt;/PRE&gt;

I tried to reference it, but obviously I get Memory Access Exception.</description>
      <pubDate>Tue, 29 Jun 2021 15:16:20 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279207#M2149</guid>
      <dc:creator>Mihalcea Bogdan</dc:creator>
      <dc:date>2021-06-29T15:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279208#M2150</link>
      <description>It's a general rule for all applications that they should draw only when the operating system requests them to do so. In your case it means that you can draw only in the &lt;B&gt;UserItemUpdate&lt;/B&gt; function, so the context can't be reused. Fortunately, you can request the operating system to redraw. Call the &lt;B&gt;userItem.Redraw (true, true)&lt;/B&gt; function which will force the call of &lt;B&gt;UserItemUpdate&lt;/B&gt;.</description>
      <pubDate>Wed, 30 Jun 2021 04:49:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279208#M2150</guid>
      <dc:creator>Viktor Kovacs</dc:creator>
      <dc:date>2021-06-30T04:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Picture boxes or canvas tools in Dialogs?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279209#M2151</link>
      <description>&lt;BLOCKQUOTE&gt;Viktor wrote:&lt;BR /&gt;
It's a general rule for all applications that they should draw only when the operating system requests them to do so. In your case it means that you can draw only in the &lt;B&gt;UserItemUpdate&lt;/B&gt; function, so the context can't be reused. Fortunately, you can request the operating system to redraw. Call the &lt;B&gt;userItem.Redraw (true, true)&lt;/B&gt; function which will force the call of &lt;B&gt;UserItemUpdate&lt;/B&gt;.
&lt;/BLOCKQUOTE&gt;

I did observe this behaviour, I thought that this kind of approach is wrong(I have some JavaScript webgl background where the context is a variable accessible by any function). Thank you again!</description>
      <pubDate>Wed, 30 Jun 2021 05:55:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Picture-boxes-or-canvas-tools-in-Dialogs/m-p/279209#M2151</guid>
      <dc:creator>Mihalcea Bogdan</dc:creator>
      <dc:date>2021-06-30T05:55:54Z</dc:date>
    </item>
  </channel>
</rss>

