LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

extra Panel in Panels and Controls in panel generated .h file

Solved!
Go to solution

I have one panel in my project, it is called LO_LVL_PNL.

The generated header file seems to think there is more. Here is the "Panels and Controls" section on the generated header file:

 

 

/* Panels and Controls: */ #define DITHER 1 #define DITHER_CLOSE 2 /* callback function: DITHER_CLOSE_CB */ #define DITHER_Dither_Settings 3 /* callback function: DITHER_CONTROL */ #define LO_LVL_PNL 2 #define LO_LVL_PNL_SENDBUTTON_2 2 /* callback function: DIDsBUTTONcb */ #define LO_LVL_PNL_SENDBUTTON_3 3 /* callback function: EraseBUTTONcb */ #define LO_LVL_PNL_SENDBUTTON_4 4 /* callback function: SENDBUTTON_noe_cb */ #define LO_LVL_PNL_SENDBUTTON 5 /* callback function: SENDBUTTONcb */ #define LO_LVL_PNL_RESET_CAN 6 /* callback function: RESET_CAN_CB */ #define LO_LVL_PNL_UUTRESPONSE 7 /* callback function: UUT_RESPONSE */ #define LO_LVL_PNL_CLEARBUTTON 8 /* callback function: CLEARBUTTONcb */ #define LO_LVL_PNL_EXIT_BUTTON 9 /* callback function: cb_quit */ #define LO_LVL_PNL_Comm_Set_TEXTBOX 10 #define LO_LVL_PNL_COMMANDBUTTON 11 /* callback function: CheckState */ #define LO_LVL_PNL_COMMANDBUTTON_2 12 /* callback function: Select_Files_DID */ #define LO_LVL_PNL_BINARYSWITCH 13 /* callback function: SetProgram */

 

in my UIR I can find the LO_LVL_PNL components, but not the DITHER pieces.

 

So, I renamed my generated header file, so it would regenerate it without these extra items, but they get included when I recreate it.

 

In the UIR file, if I double click he panel it opens and shows the panel is indeed called LO_LVL_PNL.

 

This started because I am trying to read the value of a switch on the panel, and in the call I get a run time error that follows:

 

            GetCtrlAttribute(LO_LVL_PNL, LO_LVL_PNL_BINARYSWITCH, ATTR_ON_VALUE, &on_off);

 

NON-FATAL RUN-TIME ERROR:   "gui_handler.c", line 135, col 13, thread id 0x0000179C:   Library function error (return value == -42 [0xffffffd6]). The handle is not a panel handle
 

 

I don't know if this is two separate issues, or the DITHER things cause the error; but I need help to fix both.

 

0 Kudos
Message 1 of 5
(3,680 Views)
Solution
Accepted by topic author Ken-This-is-my-stinking-a

The first parameter to GetCtrlAttribute() should be the panel handle, not the panel ID. The handle is returned from your LoadPanel() call.

 

Did you ever have a panel called DITHER? Copied from a previous project, perhaps? Maybe the UIR editor has hidden it or placed it off-screen. Try using the Find Panel editor option to see.

 

JR

Message 2 of 5
(3,677 Views)

JR,

 

Right on both counts.

 

Got rid of the extra stuff and got the handle, problem is a naming issue, the handle is LO_LVL_PANEL, the constant is LO_LVL_PNL; too close for my comfort. I'm going to change this before I make the same mistake.

 

Thanks

0 Kudos
Message 3 of 5
(3,671 Views)

Hi Ken,

 

Not directly related to your question but I could not help responding when I saw the UIR names.

 

It is always nice to have a naming convention when building your GUI.

 

Always capitalize the panel and control constants. 

Personally, I pick short (single word, without underscores etc) names like "MAINPNL" for panel names because they appear as prefix to every control on that panel.

 

I also add a 3-4 letter prefix to every control according to their type. i.e: BTN_QUIT

This way I can recognize every control from its name and still their names stay short.

Better than writing COMMANDBUTTON at the end of every control. 

 

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 5
(3,655 Views)

ebalci,

 

I'm working with inherited code; mostly. Trying to clean it up a little, but I don't have too much time to tinker with it.

0 Kudos
Message 5 of 5
(3,648 Views)