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

How to put a user control into a listbox?

nishida_jp
Participant

I program C++/Add-on in ArchiCAD27 / Visual StudioC++2019 / Windows 10.

I try UserControl(Pen Type) in ListBox.
But can't put user control into a listbox,
How to put a user control into a listbox?

 

1)grc
/* [11] */ MultiSelList 21 72 903 356 LargePlain PartialItems 21 HasHeader 21
/* [12] */ UserControl 55 451 180 40 257 0x0001 0x0000 0 



2)cpp : OpenDialog()

res = DGModalDialog(
ACAPI_GetOwnResModule()
, resID //grcでのdialog/palette定義ID
, ACAPI_GetOwnResModule()
, staticDlgMsgCallBack
, (DGUserData)_this
);
3)cpp : MsgInit() Event
//UserControl
API_UCCallbackType ucb;
BNZeroMemory(&ucb, sizeof(ucb));
ucb.dialogID = this->dialID;
ucb.type = APIUserControlType_Pen;
ucb.itemID = ctrl_id;//ctrl_id==12
ACAPI_Dialog_SetUserControlCallback(&ucb);

4)cpp : MakeListBox()
//ctrl_id==12
NiArchi::DGSetItemWidth(dial_id, ctrl_id, w);
NiArchi::DGSetItemHeight(dial_id, ctrl_id, h);
DGSetItemValLong(this->dialID, ctrl_id, (short)color);
DGListSetDialItemOnTabField(dial_id, grid_id, col, ctrl_id);

 

 If the control_id is a popup or button, it will be displayed correctly in the ListBox.
What should I do for a usercontrol?
If possible, I would like to handle everything with DG functions, rather than deriving from the Dialog class.
 
1 REPLY 1
Oleg
Expert

Try to place UserControl's line before MultiSelList line in grc .