We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.

List box header

dushyant
Enthusiast

Hi,

I found that the list box header is also set using the list-box-header-strings-resource-ID, as below:

 

 

 

 

	// set texts:
	GS::UniString	headerName;
	RSGetIndString (&headerName, LAYER_DIALOG_LIST_BOX_HEADER_STRINGS_RESID, 1, ACAPI_GetOwnResModule());
	layerList.SetHeaderItemText (layerNameTab,		headerName);

	RSGetIndString (&headerName, LAYER_DIALOG_LIST_BOX_HEADER_STRINGS_RESID, 2, ACAPI_GetOwnResModule());
	layerList.SetHeaderItemText (statusTab,			headerName);

	RSGetIndString (&headerName, LAYER_DIALOG_LIST_BOX_HEADER_STRINGS_RESID, 3, ACAPI_GetOwnResModule());
	layerList.SetHeaderItemText (filterStatusTab,	headerName);

 

 

 

 

Though it can be set directly as:

 

 

 

 

	// set texts:
	buildMatList.SetHeaderItemText (BuildingMatNameTab,	"Building Material");
	buildMatList.SetHeaderItemText (PenIndexTab,		"cutFillPen");

 

 

 

 

What is the difference between the two? Which one is used in which case? What is the reason for setting the header using the resource IDs?

 

Also, what is the acceptable value range for the List Box Header Strings Resource ID? I saw it was set to 32593 when the GDLG and DLGH were 32591 (for a dialog box). I am using a palette, so GDLG and DLGH are 32500. What should be the ID for the List Box Header Strings in this case?

 

Thanks!

 

20 REPLIES 20

Thanks for that info VEGH.

 

I have now put the listBox.Resize() and button.Move() within BeginMoveResizeItems() and EndMoveResizeItems(). And the tabs layouting after that.

Although I did have to change the value of begin-position for listBox.SetTabFieldBeginEndPosition(). I was trying to get the existing begin-position for each tab, but that was giving out some strange behaviour. So I just started with 0 for the first tab and added the tabWidth for the next tab. Now it works perfectly. Thanks again.

 

Do you know where I could find the documentation on list-boxes and other controls as button, checkbox, text, etc.? I could not find it on the online Archicad API Reference.

As far as I know Dialog Manager Documentation is part of the API DevKit.

I was only referring the online documentation. Will check out the DevKit docs.

Thanks a lot!

 

dushyant
Enthusiast

Is the ListBoxSelectionChanged event only triggered when there's a manual (mouse interaction) selection by the user in the list box?

I am selecting the list box item as: 

listBox.SelectItem(1);

and the item does get selected in the list, but the following function is not called:

virtual void ListBoxSelectionChanged(const DG::ListBoxSelectionEvent& ev) override;

It's only called when the list box item is manually selected by a mouse-click.

Yes. In general DG notifications follow the changes only from user interactions.

If you create a change handler function you can call it from the DG notification and elsewhere also when a Set function is called.

dushyant
Enthusiast

Which ones are you referring to as 'DG notifications' and 'change handler function'?

 

I mean DG notifications are ButtonClicked, ListBoxSelectionChanged and so on.

Handler function is what you implement to adjust dialog data or dialog item states.

Something like this:

void SometDialog::ButtonClicked (const DG::ButtonClickEvent& ev)
{
    MyClickHandlerToDoWhatever ();
}

 

This MyClickHandler can be called from elsewhere also.

dushyant
Enthusiast

Ok. So ListBoxSelectionChange() was not being called when I changed the list-box-selection from MyChangeHandler();

dushyant
Enthusiast

To get the data stored in a row in a list box as:

 

DGUserData data = DGListGetItemUserData(SelectionPaletteResId, ListBoxId, listItemIndex);

 

What kind of DGUserData value is to be set in:

DGListSetItemUserData (short dialId, short item, short listItem, DGUserData value);

DGUserData seems to be an integer:  typedef long long Int64; typedef Int64 IntPtr; typedef GS::IntPtr DGUserData;

 

You can put any arbirtary value in the userdata of each item as far as it fits in GS::IntPtr. We used to put there a pointer to some data (before the c++ world).

Now it is better/safer to attach c++ objects to the list items. These member functions can be used (please see DGListBox.hpp):

void SetItemObjectData (short listItem, GS::Ref<GS::Object> object);
GS::Ref<GS::Object> GetItemObjectData (short listItem) const;

 Any object inherited from the GS::Object can be used here in the GS::Ref.