Notifications
Clear all

[Closed] Disabling group of CustonControls

I have a checkBox that its function is to enable/disable a group of controls as other checkBoxes, buttons, lists…
I’m working with MAX 8 SDK to create a plugin. I think that it must something like SendDlgMessage( … ) to the controls that must be enabled/disabled but SDK hasn’t such information about.
How can i get it?

16 Replies

Hi,

You can try:

SendMessage(hWndCtrl, WM_ENABLE, false, 0);

Get a look at http://msdn2.microsoft.com/en-gb/library/ms649776.aspx and http://msdn2.microsoft.com/en-gb/library/ms649775.aspx .
You can also look at some plugins samples using win32 user interface. For example the ASCII exporter.

Well, if I had understood, hWndCtrl must be our RollUp handle (hDlg in my case), WM_ENABLE is the action sent (WM_DISABLE in case to disable), “false” is the part I don’t understand, and “0”. How can access to for example IDC_LIST1 or IDC_CHECK_X to enable/disable them? false and 0 must have differente values (HWord, LWord) or I’m taking it wrong?

I don’t know wher has gone my previous reply but, I think that it will appear later…
I forget to enter in the last reply that in the plugin, before, i was using
SendDlgItemMessage(hDlg, IDC_LIST1, LB_DELETESTRING, 0, 0) like commands. And all was OK.

Hi,

We set true/false wether we want to enable/disable the control. We set 0 (understand NULL) when the parameter is not used.

SendMessage(hWndCtrl, WM_ENABLE, true, 0); // Enable hWndCtrl
SendMessage(hWndCtrl, WM_ENABLE, false, 0); // Disable hWndCtrl

To disable IDC_LIST1 we can use :

SendDlgItemMessage(hDlg, IDC_LIST1, WM_ENABLE, false, 0)

win32 is a confusing. I think that .NET (windows forms) is better. Furthermore, now in the version 9 we can use .NET 2.0 to create the user interface of a plugin.

I have done as you replied me, yanick, but it doesn’t work. I can’t disable my custom controls but the code is executed without errors. I don’t know if I had forgoten something or… it is because other thing.
If it is helpful, I can upload part of the code to show how it works.

Yes, can you upload your code ?

This is the function that enables/disables ths cc of the hDlg RollUp:

void enableBlocks(HWND hDlg, int state)

{MessageBox(0,”Proc: enablingBlocks ” + _T(state),“Kontrol puntua”,MB_OK);

[indent]// IDC_STATIC4 IDC_STATIC5 CHECK_X,Y,Z IDC_LIST_BLOQUEOS IDC_BUTTON_ADD,DEL,EMPTY_LIST

if ( state == FALSE ) {
//SendDlgItemMessage( hDlg, IDC_STATIC4, WM_ENABLE, FALSE, 0);
//SendDlgItemMessage( hDlg, IDC_STATIC5, WM_ENABLE, FALSE, 0);
SendDlgItemMessage( hDlg, IDC_CHECK_X, WM_ENABLE, FALSE, 0);
SendDlgItemMessage( hDlg, IDC_CHECK_Y, WM_ENABLE, FALSE, 0);
SendDlgItemMessage( hDlg, IDC_CHECK_Z, WM_ENABLE, FALSE, 0);
SendDlgItemMessage( hDlg, IDC_LIST_BLOQUEOS, WM_ENABLE, FALSE, 0);
SendDlgItemMessage( hDlg, IDC_BUTTON_ADD_BLOQUEO, WM_ENABLE, FALSE, 0);
SendDlgItemMessage( hDlg, IDC_BUTTON_DEL_BLOQUEO, WM_ENABLE, FALSE, 0);
SendDlgItemMessage( hDlg, IDC_BUTTON_EMPTY_LIST, WM_ENABLE, FALSE, 0);
} else {
//SendDlgItemMessage( hDlg, IDC_STATIC4, WM_ENABLE, TRUE, 0);
//SendDlgItemMessage( hDlg, IDC_STATIC5, WM_ENABLE, TRUE, 0);
SendDlgItemMessage( hDlg, IDC_CHECK_X, WM_ENABLE, TRUE, 0);
SendDlgItemMessage( hDlg, IDC_CHECK_Y, WM_ENABLE, TRUE, 0);
SendDlgItemMessage( hDlg, IDC_CHECK_Z, WM_ENABLE, TRUE, 0);
SendDlgItemMessage( hDlg, IDC_LIST_BLOQUEOS, WM_ENABLE, TRUE, 0);
SendDlgItemMessage( hDlg, IDC_BUTTON_ADD_BLOQUEO, WM_ENABLE, TRUE, 0);
SendDlgItemMessage( hDlg, IDC_BUTTON_DEL_BLOQUEO, WM_ENABLE, TRUE, 0);
SendDlgItemMessage( hDlg, IDC_BUTTON_EMPTY_LIST, WM_ENABLE, TRUE, 0);
}

[/indent]}

When we klik on the checkBox that must enable the group of cc:

if ( GetCheckBox(hDlg, IDC_CHECK_BLOQUEO) == BST_CHECKED)
enableBlocks( hDlg, TRUE ); // Enable ipini
else enableBlocks( hDlg, FALSE ); // Disable ipini

Hi.

Try something like this:

void EnableBlocks(HWND hDlg, BOOL enable)
{
	EnableWindow(GetDlgItem(hDlg, IDC_CHECK_X), enable);
	EnableWindow(GetDlgItem(hDlg, IDC_CHECK_Y), enable);
	EnableWindow(GetDlgItem(hDlg, IDC_CHECK_Z), enable);
	EnableWindow(GetDlgItem(hDlg, IDC_LIST_BLOQUEOS), enable);
	EnableWindow(GetDlgItem(hDlg, IDC_BUTTON_ADD_BLOQUEO), enable);
	EnableWindow(GetDlgItem(hDlg, IDC_BUTTON_DEL_BLOQUEO), enable);
	EnableWindow(GetDlgItem(hDlg, IDC_BUTTON_EMPTY_LIST), enable);
}

Still doesn’t work and I have no idea of why!!!

Page 1 / 2