<?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: ACAPI_Element_Change in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228620#M3749</link>
    <description>So it seems that adding this:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt; return ACAPI_CallUndoableCommand("JHP Menu Command Function",
	[&amp;amp;]() -&amp;gt; GSErrCode {
&lt;/PRE&gt;

&lt;BR /&gt;
to wrap my menu load that does the function call solves the problem.&lt;BR /&gt;
&lt;BR /&gt;
And after I successfully convert my selected text to upper case, I can ^Z back to lower case.  Not what I would expect with 'ACAPI_CallUndoableCommand'.&lt;BR /&gt;
&lt;BR /&gt;
Can someone please explain???&lt;BR /&gt;
&lt;BR /&gt;
thanks - chris</description>
    <pubDate>Wed, 29 May 2019 14:52:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-05-29T14:52:32Z</dc:date>
    <item>
      <title>ACAPI_Element_Change</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228619#M3748</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;I started with the Do_Word_Edit function found in ..\Examples\Element_Test in the Element_Modify.cpp file. I am using the true part of (mode==1) of the if to "Click a word to change its content". My intent is to change selected text to upper case. All existing code is untouched until after&lt;BR /&gt;"strcpy(*memo.textContent, text);"&lt;BR /&gt;&lt;BR /&gt;Then:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;		strcpy(*memo.textContent, text);

&amp;lt;my modification&amp;gt;
		// Test getting the memo of the existing text
		ACAPI_Element_GetMemo(element.header.guid, &amp;amp;memo, APIMemoMask_TextContent);
		CHtoUpper(*memo.textContent);
		JHP_Msg(*memo.textContent);  // displays selected text with conversion to upper case
&amp;lt;/my modification&amp;gt;

		err = ACAPI_Element_Change(&amp;amp;element, &amp;amp;mask, &amp;amp;memo, APIMemoMask_TextContent, true);

&amp;lt;my modification&amp;gt;
		if (err != NoError) // always true.
		{
			JHP_Msg("There is an error.");
			JHP_Msg((strerror(err))); // Error message in plain English is "Unknown error"
		}
&amp;lt;/my modification&amp;gt;

		ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
&lt;/PRE&gt;
&lt;BR /&gt;I am having trouble with ACAPI_Element_Change. Since I believe my modifications are only the conversion to upper case and verification of error after ACAPI_Element_Change, I am not quite sure what I did to break it. In my mind, the ACAPI_Element_Change is operating just the same as it was used in the example from the Element_modify.cpp file.&lt;BR /&gt;&lt;BR /&gt;What am I missing?&lt;BR /&gt;&lt;BR /&gt;Thanks - &lt;BR /&gt;chris&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Oct 2022 14:31:45 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228619#M3748</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-04T14:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: ACAPI_Element_Change</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228620#M3749</link>
      <description>So it seems that adding this:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt; return ACAPI_CallUndoableCommand("JHP Menu Command Function",
	[&amp;amp;]() -&amp;gt; GSErrCode {
&lt;/PRE&gt;

&lt;BR /&gt;
to wrap my menu load that does the function call solves the problem.&lt;BR /&gt;
&lt;BR /&gt;
And after I successfully convert my selected text to upper case, I can ^Z back to lower case.  Not what I would expect with 'ACAPI_CallUndoableCommand'.&lt;BR /&gt;
&lt;BR /&gt;
Can someone please explain???&lt;BR /&gt;
&lt;BR /&gt;
thanks - chris</description>
      <pubDate>Wed, 29 May 2019 14:52:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228620#M3749</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-29T14:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: ACAPI_Element_Change</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228621#M3750</link>
      <description>Functions like &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_Element_Change&lt;E&gt;&lt;/E&gt; cause changes to the database which the user should be able to undo. In order for these functions to work, you need to enclose them in &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_CallUndoableCommand&lt;E&gt;&lt;/E&gt; to prepare ARCHICAD for undoable changes. If you don't, ARCHICAD will refuse to complete the function and return an error.</description>
      <pubDate>Wed, 29 May 2019 22:04:51 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228621#M3750</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-05-29T22:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: ACAPI_Element_Change</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228622#M3751</link>
      <description>Thanks for the insight Ralph.  It just sounds a little counter-intuitive.  I feel like getting this first function call from my menu sets up a good template for the others that will follow.  Thanks again for your help.&lt;BR /&gt;
- chris</description>
      <pubDate>Thu, 30 May 2019 14:48:33 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228622#M3751</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-30T14:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: ACAPI_Element_Change</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228623#M3752</link>
      <description>&lt;BLOCKQUOTE&gt;chrisgilmer wrote:&lt;BR /&gt;
Thanks for the insight Ralph.  It just sounds a little counter-intuitive&lt;/BLOCKQUOTE&gt;
It might help if you think about it as a database transaction. Marking the beginning and end of a transaction allows that specific action to be rolled back, in this case by the user requesting an 'Undo'</description>
      <pubDate>Fri, 31 May 2019 14:21:45 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228623#M3752</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-05-31T14:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: ACAPI_Element_Change</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228624#M3753</link>
      <description>I get the database marks and thanks for emphasizing that part of it.&lt;BR /&gt;
&lt;BR /&gt;
I just realized I was putting emphasis on the wrong syllables.  I was reading it as "I am calling a command that does not respond to ^Z" instead of "I am calling a command that allows ^Z, therefore it is undoable".&lt;BR /&gt;
&lt;BR /&gt;
"Let's eat grandma" vs. "Let's eat, grandma".&lt;BR /&gt;
&lt;BR /&gt;
Thanks again -&lt;BR /&gt;
chris</description>
      <pubDate>Fri, 31 May 2019 16:42:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-Element-Change/m-p/228624#M3753</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-31T16:42:40Z</dc:date>
    </item>
  </channel>
</rss>

