Notifications
Clear all

[Closed] SDK: Update UI?

Hi,
I’m creating an object plugin, I’ve created a button and I need to change the caption on it, so I do it with

SendDlgItemMessage(hWnd, IDC_BUTTON, WM_SETTEXT, 0, "New caption");

It works ok, but everytime I leave the modify mode for example by selecting another object (EndEditParams function is called I guess), select it again and go to the modify mode (BeginEditParams?) the button has default caption. Is it normal? Should I update the whole UI everytime I select my plugin object? Should I do it in BeginEditParams?

1 Reply

you would normally just handle stuff like that in the WM_INITDIALOG event handler of the ParamMap2UserDlgProc:: DlgProc function

one off mine looks a bit like this

INT_PTR QuadCloudObjDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
  {
  	panelhWnd = hWnd;
  	switch (msg) 
  	{
  		case WM_INITDIALOG: 
  		{
  			InitPanel(t);
  			break;
  		}

then

void QuadCloudObjDlgProc::InitPanel(TimeValue t)
  { 
  	if(!panelhWnd) 
  		return;
  
  // update the number of quads in cloud
  
  	qc->qcStatus = GetICustStatus(GetDlgItem(panelhWnd, IDC_QC_QUAD_COUNT_CSTS));
  	qc->qcStatus->Execute(I_EXEC_CS_NO_BORDER);
  	qc->UpdateQuadCountStatus();
  
  ....