<?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 [SOLVED] DG Message when palette dialog is docked? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-DG-Message-when-palette-dialog-is-docked/m-p/225507#M8385</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;Hello,&lt;BR /&gt;Is there a DG Message in callback when a palette dialog is docked? Or know when docking location changes/what the docked location is?&lt;BR /&gt;&lt;BR /&gt;What I want to do is to re-arrange my dialog items whenever the dialog is docked according to its docked location.&lt;BR /&gt;&lt;BR /&gt;For ex. I have a palette with 2 list box: if I docked it on top, it will look like the 2nd screen. If I docked it on left/right, instead of the one in the 3rd screen it'll move the 2nd list box and put it at the bottom of the 1st list box, taking less space than if I didn't re-arrange it.&lt;BR /&gt;&lt;BR /&gt;Is this possible?&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Palette.png" style="width: 847px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/37710iDB06D5B81FA97CAC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Palette.png" alt="Palette.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Sep 2024 07:52:29 GMT</pubDate>
    <dc:creator>Erenford</dc:creator>
    <dc:date>2024-09-24T07:52:29Z</dc:date>
    <item>
      <title>[SOLVED] DG Message when palette dialog is docked?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-DG-Message-when-palette-dialog-is-docked/m-p/225507#M8385</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello,&lt;BR /&gt;Is there a DG Message in callback when a palette dialog is docked? Or know when docking location changes/what the docked location is?&lt;BR /&gt;&lt;BR /&gt;What I want to do is to re-arrange my dialog items whenever the dialog is docked according to its docked location.&lt;BR /&gt;&lt;BR /&gt;For ex. I have a palette with 2 list box: if I docked it on top, it will look like the 2nd screen. If I docked it on left/right, instead of the one in the 3rd screen it'll move the 2nd list box and put it at the bottom of the 1st list box, taking less space than if I didn't re-arrange it.&lt;BR /&gt;&lt;BR /&gt;Is this possible?&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Palette.png" style="width: 847px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/37710iDB06D5B81FA97CAC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Palette.png" alt="Palette.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 07:52:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-DG-Message-when-palette-dialog-is-docked/m-p/225507#M8385</guid>
      <dc:creator>Erenford</dc:creator>
      <dc:date>2024-09-24T07:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: DG Message when palette dialog is docked?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-DG-Message-when-palette-dialog-is-docked/m-p/225508#M8386</link>
      <description>Dear ArchiCAD-Talk forum members, &lt;BR /&gt;
 &lt;BR /&gt;
today I implemented a "new API function" just for you:&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;ACAPI_Notify_CatchDockStateChanged&lt;/B&gt; &lt;BR /&gt;
With this function you can catch dock/undock events and docked title orientation changed events also. &lt;BR /&gt;
 &lt;BR /&gt;
Interface: 
&lt;PRE&gt;typedef struct { 
	short	dialId; 
	bool	isDocked; 
	bool	isDockedTitleHorizontal; 
} API_DockStateInfo; 
 
typedef void	__ACENV_CALL	APIDockStateChangedCallBackProc (short dialId, API_DockStateInfo dockStateInfo); 
 
void	ACAPI_Notify_CatchDockStateChanged (short dialId, APIDockStateChangedCallBackProc *callBackProc);&lt;/PRE&gt; &lt;BR /&gt;
 &lt;BR /&gt;
Implementation: 
&lt;PRE&gt;void	ACAPI_Notify_CatchDockStateChanged (short dialId, APIDockStateChangedCallBackProc *callBackProc) 
{ 
	if (DGGetDialogType (dialId) == DG_DT_PALETTE) { 
		static GS::HashTable&amp;lt;short, API_DockStateInfo&amp;gt; dockStateInfos; 
		API_DockStateInfo actDockStateInfo; 
		actDockStateInfo.dialId = dialId; 
 
		GS::Guid paletteGuid; 
		DGGetPaletteGuid (dialId, &amp;amp;paletteGuid); 
 
		actDockStateInfo.isDocked = DGIsPaletteDocked (paletteGuid); 
 
		short hFrameSize; 
		short vFrameSize; 
		short hClientSize; 
		short vClientSize; 
		DGGetDialogSize (ACAPI_GetOwnResModule (), dialId, DG_ORIGFRAME, &amp;amp;hFrameSize, &amp;amp;vFrameSize); 
		DGGetDialogSize (ACAPI_GetOwnResModule (), dialId, DG_ORIGCLIENT, &amp;amp;hClientSize, &amp;amp;vClientSize); 
		actDockStateInfo.isDockedTitleHorizontal = (hFrameSize - hClientSize &amp;gt; vFrameSize - vClientSize); 
 
		API_DockStateInfo prevDockStateInfo; 
		if (!dockStateInfos.Get (dialId, &amp;amp;prevDockStateInfo)									|| 
			prevDockStateInfo.isDocked					!= actDockStateInfo.isDocked				||  
			prevDockStateInfo.isDockedTitleHorizontal	!= actDockStateInfo.isDockedTitleHorizontal) 
		{ 
			dockStateInfos.Put (dialId, actDockStateInfo); 
			callBackProc (dialId, actDockStateInfo); 
		} 
	} 
}&lt;/PRE&gt; &lt;BR /&gt;
 &lt;BR /&gt;
Example: 
&lt;PRE&gt;void	__ACENV_CALL DockStateChangedCallBack (short dialId, API_DockStateInfo dockStateInfo) 
{ 
	char buffer[512]; 
	sprintf (buffer, "DockStateChanged: dialId=%d, isDocked=%d, isDockedTitleHorizontal=%d", dialId, dockStateInfo.isDocked, dockStateInfo.isDockedTitleHorizontal); 
	ACAPI_WriteReport (buffer, true); 
	// Handle dock state changed event as you want! 
} 
 
// -------------------------------------- With C++ style Palette: ----------------------------------------------------- 
 
// Define the following function in the dialog's observer class: 
		virtual void PanelIdle (const DG::PanelIdleEvent&amp;amp;); 
 
// ------------------------------- 
 
void	MyDialogObserver:PanelIdle (const DG::PanelIdleEvent&amp;amp; /*ev*/) 
{ 
	ACAPI_Notify_CatchDockStateChanged (myDialog-&amp;gt;GetId (), DockStateChangedCallBack); 
	// myDialog is a pointer to the dialog 
} 
 
// ---------------------------------------- With C style Palette: ----------------------------------------------------- 
 
// In the dialog's callback function: 
//		at the end of DG_MSG_INIT message handling: 
			DGEnableMessage (dialID, DG_ALL_ITEMS, DG_MSG_NULL); 
			break; 
		case DG_MSG_NULL: 
			ACAPI_Notify_CatchDockStateChanged (dialID, DockStateChangedCallBack); 
			break;&lt;/PRE&gt; &lt;BR /&gt;
 &lt;BR /&gt;
Feel free to use this and please report me here if you have any problem about this function!  &lt;BR /&gt;
 &lt;BR /&gt;
Regards, &lt;BR /&gt;
Tibor</description>
      <pubDate>Mon, 17 Nov 2014 21:27:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-DG-Message-when-palette-dialog-is-docked/m-p/225508#M8386</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2014-11-17T21:27:16Z</dc:date>
    </item>
  </channel>
</rss>

