LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Show / Hide controls

Solved!
Go to solution

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? 

0 Kudos
Message 1 of 6
(4,981 Views)

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);



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 6
(4,974 Views)

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.
 

0 Kudos
Message 3 of 6
(4,971 Views)

La cosa strana è che la stessa procedura sul pannelo principale funziona....

0 Kudos
Message 4 of 6
(4,965 Views)

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);
 

 

0 Kudos
Message 5 of 6
(4,963 Views)
Solution
Accepted by topic author ViperNaples

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).

0 Kudos
Message 6 of 6
(4,959 Views)