WM_INITDIALOG in ParamMap2UserDlgProc

WM_INITDIALOG in ParamMap2UserDlgProc

Anonymous
Not applicable
559 Views
5 Replies
Message 1 of 6

WM_INITDIALOG in ParamMap2UserDlgProc

Anonymous
Not applicable
What are the rules to disable ParamBlk2 items on a panel?
I did an EnableWindow() in WM_INITDIALOG but all ParamBlk2 controls are still active - in contrast all standard windows controls behave correct. Even when I can disable these controls later, every "repaint" of the dialog panel puts them to enable again?


class cPanel2DlgProc : public ParamMap2UserDlgProc
{
public:
HWND hWin;

cPanel2DlgProc() {}

INT_PTR DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
switch (msg)
{
case WM_INITDIALOG:
{
HWND h = GetDlgItem( hWnd, IDC_PBLK2ITEM );
if (h)
EnableWindow( h, false ); // <<< this one fails..
}
break;
}
}

void DeleteThis() { }
};
0 Likes
560 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
I've put similar code to NotifyRefChanged() func. In my case, I have material type and some ui should be disabled for some types. So, when material type is changed ui can be disabled.
You can do same thing in CreateParamDlg()


IParamMap2* pMap = PBlock->GetMap( YOUR_ROLLOUT );
if( pMap ){
HWND hWnd = pMap->GetHWnd();
EnableWindow(GetDlgItem( hWnd, YOUR_CONTROL ), false);
}
0 Likes
Message 3 of 6

Anonymous
Not applicable
Hi Michael,
to be honest, I do not see any difference. The HWND is exactly the same.
The question is where all I have to add this code, as every refresh of the UI enables the dlg controls again.
Istan
0 Likes
Message 4 of 6

Anonymous
Not applicable
That's strange, it shouldn't be enabled just be refreshing. May be you are doing something wrong in other place?

What kind of plug-in you making? Is it object? Material? Modifier?.. Do you use P_MULTIMAP for ParamBlock? What type of control you trying to disable?

For example, to disable 3dsmax custom control (such as buttons, spinners etc) you should take ICustom<Type>* and call Disable():

ICustButton* pICustBtn = GetICustButton(GetDlgItem(hWnd,IDC_CUSTOMBUTTON));
pICustBtn->Disable();
ReleaseICustButton( pICustBtn );
0 Likes
Message 5 of 6

Anonymous
Not applicable
Solved!!! My general "Enable" function failed in getting the Cust control pointer properly.
Thanks!
0 Likes
Message 6 of 6

Anonymous
Not applicable
You are welcome 🙂
0 Likes