<?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: Change focus event in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/644997#M10063</link>
    <description>&lt;P&gt;You should implement a new class having the DG::ApplicationObserver as a base, this way inheriting the virtual notification functions which will be overridden. Then you attach the instance of your class to the DG::Application (which is a DG::EventSource). When the events emerge, DG::Application (the EventSource) will call the overridden virtual functions in your attached observer class. You can try something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;class AppObserver: public DG::ApplicationObserver
{
private:
	bool isInModalState = false;

public:
	AppObserver ();
	~AppObserver ();

	bool IsInModalState () const;

protected:
	virtual void	ModalStateBegin (void) override;
	virtual void	ModalStateEnd (void) override;
};


AppObserver::AppObserver ()
{
	DG::Application::GetInstance ()-&amp;gt;Attach (*this);
}

AppObserver::~AppObserver ()
{
	DG::Application::GetInstance ()-&amp;gt;Detach (*this);
}


bool IsInModalState () const
{
	return isInModalState;
}


void	AppObserver::ModalStateBegin (void)
{
	isInModalState = true;
}


void	AppObserver::ModalStateEnd (void)
{
	isInModalState = false;
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I did not try to compile these lines).&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jan 2025 09:40:12 GMT</pubDate>
    <dc:creator>Miklos Vegh</dc:creator>
    <dc:date>2025-01-02T09:40:12Z</dc:date>
    <item>
      <title>Change focus event</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/641802#M10016</link>
      <description>&lt;P&gt;Hello. I am trying to implement one algorithm but for that I need somehow to detect that you have opened a certain window in Archicad that changes the focus of the application to that window, for ex. a modal dialogue or windows such as those:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Emkave_0-1732985822992.png" style="width: 483px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/80261iF5354206F5AA2EAA/image-dimensions/483x365?v=v2" width="483" height="365" role="button" title="Emkave_0-1732985822992.png" alt="Emkave_0-1732985822992.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Emkave_1-1732985895811.png" style="width: 300px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/80262iD370B9ED8D6C9EB2/image-dimensions/300x549?v=v2" width="300" height="549" role="button" title="Emkave_1-1732985895811.png" alt="Emkave_1-1732985895811.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Emkave_2-1732985924330.png" style="width: 720px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/80263i8248FD5318A02F0A/image-dimensions/720x805?v=v2" width="720" height="805" role="button" title="Emkave_2-1732985924330.png" alt="Emkave_2-1732985924330.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I guess you got it. Do you know any Archicad API command that could help detecting such focus changes? I have been searching for that command, however, I am either blind or the command does not exist. Thank you in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="grey"&gt;Operating system used: &lt;EM&gt;Windows 11&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2025 08:26:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/641802#M10016</guid>
      <dc:creator>Emkave</dc:creator>
      <dc:date>2025-02-14T08:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Change focus event</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/642916#M10023</link>
      <description>&lt;P&gt;Hi, there is a function in the DG.h header file:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;DG_DLL_EXPORT bool CCALL DGIsInModalState (void);&lt;/LI-CODE&gt;
&lt;P&gt;This can be used to decide whether a modal dialog is open or not.&lt;/P&gt;
&lt;P&gt;And if you attach to the DG::ApplicationObserver, you will be notified about modal state change.&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;class DG_DLL_EXPORT ApplicationObserver: public GS::EventObserver
{
	...
	virtual void	ModalStateBegin (void);
	virtual void	ModalStateEnd (void);
	...
public:
	ApplicationObserver ();
	virtual ~ApplicationObserver ();
};
&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Dec 2024 13:20:09 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/642916#M10023</guid>
      <dc:creator>Miklos Vegh</dc:creator>
      <dc:date>2024-12-09T13:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Change focus event</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/644879#M10057</link>
      <description>&lt;P&gt;Hi. Thank you for the help. I suppose those functions should be overridden and are invoked by Archicad itself, right? Shouldn't I somehow attach it to Archicad or? I just added the solution to the code, and put a breakpoint to debug, but nothing happened. None of those functions were invoked by Archicad or anything else. In the screenshots you will see some of my attempts to invoke the functions by overriding or defining them, however nothing happened.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Emkave_0-1735564368120.png" style="width: 541px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/81457i955117C9EBFC5BB0/image-dimensions/541x547?v=v2" width="541" height="547" role="button" title="Emkave_0-1735564368120.png" alt="Emkave_0-1735564368120.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Emkave_2-1735564588975.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/81459i8A87842AB7BC75E9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Emkave_2-1735564588975.png" alt="Emkave_2-1735564588975.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2024 19:25:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/644879#M10057</guid>
      <dc:creator>Emkave</dc:creator>
      <dc:date>2024-12-31T19:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: Change focus event</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/644997#M10063</link>
      <description>&lt;P&gt;You should implement a new class having the DG::ApplicationObserver as a base, this way inheriting the virtual notification functions which will be overridden. Then you attach the instance of your class to the DG::Application (which is a DG::EventSource). When the events emerge, DG::Application (the EventSource) will call the overridden virtual functions in your attached observer class. You can try something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;class AppObserver: public DG::ApplicationObserver
{
private:
	bool isInModalState = false;

public:
	AppObserver ();
	~AppObserver ();

	bool IsInModalState () const;

protected:
	virtual void	ModalStateBegin (void) override;
	virtual void	ModalStateEnd (void) override;
};


AppObserver::AppObserver ()
{
	DG::Application::GetInstance ()-&amp;gt;Attach (*this);
}

AppObserver::~AppObserver ()
{
	DG::Application::GetInstance ()-&amp;gt;Detach (*this);
}


bool IsInModalState () const
{
	return isInModalState;
}


void	AppObserver::ModalStateBegin (void)
{
	isInModalState = true;
}


void	AppObserver::ModalStateEnd (void)
{
	isInModalState = false;
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I did not try to compile these lines).&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 09:40:12 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/644997#M10063</guid>
      <dc:creator>Miklos Vegh</dc:creator>
      <dc:date>2025-01-02T09:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change focus event</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/644999#M10064</link>
      <description>&lt;P&gt;Thank you for the solution! It really helped!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 10:21:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Change-focus-event/m-p/644999#M10064</guid>
      <dc:creator>Emkave</dc:creator>
      <dc:date>2025-01-02T10:21:40Z</dc:date>
    </item>
  </channel>
</rss>

