06-19-2011 05:59 AM
Hi, I've a problem whith LabWindows / CVI 8.1. I want to make certain controls appear in a panel only if the checkbox is selected.
Someone can help me, please?
Solved! Go to Solution.
06-19-2011 08:00 AM
To hide a control you can use the function SetCtrlAttribute (..., ..., ATTR_VISIBLE, 0);, while to show it you must pass 1 to the function.
In your situation, you must set a callback for the checkbox in which to do something like that:
GetCtrlVal (panelHandle, PANEL_CHECKBOX, &visible);
SetCtrlAttribute (panelHandle, PANEL_CONTROL1, ATTR_VISIBLE, visible);
06-19-2011 10:06 AM
Ciao Roberto, non volevo disturbarti ancora una volta. Sono Umberto, ci siamo sentiti altre volte per e-mail.
Avevo già provato come dici tu, ma il compilatore mi restituisce degli errori a tempo di esecuzione:
GetPanelHandleFromTabPage (pannello_2, PANEL_2_TAB, 0, &TabProfilo);
GetCtrlVal (TabProfilo, TABPANEL_2_RIEMPI, &val);
SetCtrlAttribute (TabProfilo, TABPANEL_2_FILL_SPACING, ATTR_VISIBLE, val);
se definisco la variabile val di tipo float mi restituisce: "found double, expected int"
se invece definisco val di tipo int : "found pointer to int, expected pointer to float"
sto provando a trovare una soluzione da ormai tre giorni senza però riuscirci.
06-19-2011 11:25 AM
La cosa strana è che la stessa procedura sul pannelo principale funziona....
06-19-2011 11:39 AM
Ho risolto:
l'errore lo commettevo nella funzione GetPanelHandleFromTabPage, infatti uno dei parametri è l'indice (zero-based) della tab page ed io erroneamente gli passavo 0, ma la tab page che mi interessava era la seconda e non la prima per cui dovevo passargli 1 (e non 0).
GetPanelHandleFromTabPage (pannello_2, PANEL_2_TAB, 1, &TabProfilo);
GetCtrlVal (TabProfilo, TABPANEL_2_RIEMPI, &val);
SetCtrlAttribute (TabProfilo, TABPANEL_2_FILL_SPACING, ATTR_VISIBLE, val);
06-19-2011 11:50 AM
I solved:
I committed the error in the function GetPanelHandleFromTabPage, in fact one of the parameters is the index (zero-based) of the tab page and I mistakenly passed 0, but the tab page that interested me was the second so I had to pass 1 (and not 0).