GDL
About building parametric objects with GDL.

How To Get Control Address By DGModelessInit

Anonymous
Not applicable
I make Modeless Dialog

MyDialog::Init(){
  diagId=DGModelessInit(
    ACAPI_GetOwnResModule()
    , ID_DIALOG
    , ACAPI_GetOwnResModule()
    , GroupSheetDlgCallBack
    , (DGUserData)&dlgData
    , 1);
}

But I can't change Control Width By DG Commands.

So I try Control Address.

const DG::Panel &panel = GetReference();
DG::PopUp *p = new DG::PopUp(panel, ID_POPUP);
p->SetWidth(10);
delete(p);

But MyDialogClass have no GetReference();

So MyDialog Class based by Palette

//Constructor
MyDialog::MyDialog(
) :DG::Palette(
	ACAPI_GetOwnResModule()
	, ID_DIALOG
	, ACAPI_GetOwnResModule()
	, ODLBPaletteGuid()
)
{
}

But DGModelessInit() don't use consutructor.

Please Teach Me
How to get Control Address By DGModelessInit()
DG::PopUp *p = new DG::PopUp(panel, ID_POPUP);
1 REPLY 1
Anonymous
Not applicable
Thank you for Reply.
But I Can't Popup Control Address from DGModelessInit.

I anser myself.
I can change Popup Width without Popup Control Address.
I used DG Command.

//Change Item Width
void DGSetItemWidth(short dialId, short item, short width) {
//muinus return
if (width < 0)return;

short left;
short top;
short right;
short bottom;
//Get Current Rect
DGGetItemRect(dialId, item, &left, &top, &right, &bottom);
//Calc Grow
short right2 = left + width;//new right
short hGrow = right2 - right;//grow
short vGrow = 0;
//set
DGGrowItem(dialId, item, hGrow, vGrow);
}
//Change Item Height
void DGSetItemHeight(short dialId, short item, short height) {
//minus return
if (height < 0)return;

short left;
short top;
short right;
short bottom;
//Get Current Rect
DGGetItemRect(dialId, item, &left, &top, &right, &bottom);
//Get Grow
short bottom2 = top + height;//new bottom
short hGrow = 0;
short vGrow = bottom2 - bottom;//grow
//set
DGGrowItem(dialId, item, hGrow, vGrow);

}


So Use...

DGSetItemWidth(dialId, ID_POPUP_01, 100);//Set Width=100px