Notifications
Clear all

[Closed] SDK ParamBlock2 DlgProc

I’ve been doing my DlgProcs for my ParamBlock2 a way I found in a sample. Although, after looking at different samples, not many of them seem to be using this way. So I was wondering how other people are doing and if there is a better way. As I’m starting to get small issues with it. Thanks

static SpaceTool *theSpaceTool;
  
  class DisplayDlgProc : public ParamMap2UserDlgProc{
  	public:			
  	INT_PTR DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){
  		static DRAWITEMSTRUCT* pdis;
  		theSpaceTool = (SpaceTool*)map->GetParamBlock()->GetOwner();
  		switch (msg){
  			case WM_DRAWITEM:
  				pdis = (DRAWITEMSTRUCT*) lParam;
  				theSpaceTool->DrawButtons(pdis, hInstance);
  				break;
  			case WM_CTLCOLORBTN:
  				HBRUSH hBrushBtn;
  				hBrushBtn = (HBRUSH) GetStockObject(NULL_BRUSH);
  				SetBkMode((HDC) wParam, TRANSPARENT);
  				return ((LRESULT) hBrushBtn);
  			case WM_NOTIFY:
  				switch(LOWORD(wParam)){
  				
  				}
  				break;
  			case WM_INITDIALOG:{
  				ExecuteMAXScriptScript(_T("print \"Display\""), 0, 0);
  				theSpaceTool->pblock2 = theSpaceTool->GetParamBlockByID(0);
  				break;
  			}
  			case WM_COMMAND:
  				switch( LOWORD(wParam)){
  					}
  				break;
  			default:
  				return FALSE;
  		}
  		return TRUE;
  	}
  	void DeleteThis(){};
  };
  
  DisplayDlgProc TheDisplayDlgProc;
  
  static ParamBlockDesc2 Display_param_blk (Display_params, _T("Display"), 0, GetSpaceToolDesc(),  P_AUTO_CONSTRUCT + P_AUTO_UI, DISPLAY_REF,
  										IDD_Display, IDS_DISPLAY, 0, 0, &TheDisplayDlgProc,
  										DisplayMode,  _T("Display_Mode"), 		TYPE_INT, 		0, IDS_CREATION_METHOD, 	 
  											p_default, 		0, 
  											p_range, 		0, 1, 
  											p_ui, 			TYPE_RADIO, 	4, IDC_PLANE, IDC_BOX, IDC_POINTCLOUD, IDC_ORIGINAL, 
  											p_end, 
  									  p_end);
1 Reply

think the preferred way (as it’s the most useful way)

define the dialog like this....

 
then in BeginEditParams function after the call to myclassDesc.BeginEditParams

then you pass NULL in param block definition instead of the address of your static dialog proc