LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Panel

Hi all,

 

Im a new CVI user & hoping to learn as I get along.Cat Happy

 

All UIR got a Main Panel. But from the below example, I believe it uses a separated self-declared Panel (gPanel), which I cant find it in the UIR.

Any reaason to use a different panel? Isn't it supposed to load the Main Panel Instead?

 

I extracted an example on TCP IP:

 

static int              gPanel, gConnected, gTCPError;
static unsigned int     gTCPHandle;
static int              gPanelWidth, gPanelHeight;

static void ReportTCPError(void);

 

int main (int argc, char *argv[])
{
    if (InitCVIRTE (0, argv, 0) == 0)
        return -1;
    if ((gPanel = LoadPanel (0, "tcptelnet.uir", PANEL)) < 0)
        return -1;
    GetPanelAttribute(gPanel, ATTR_WIDTH, &gPanelWidth);
    GetPanelAttribute(gPanel, ATTR_HEIGHT, &gPanelHeight);
    DisplayPanel (gPanel);
    RunUserInterface ();
    if (gConnected)
        DisconnectFromTCPServer(gTCPHandle);
    DiscardPanel (gPanel);
    return 0;
}

0 Kudos
Message 1 of 4
(4,352 Views)

Hi and welcome...

 

gPanel is not a "self-declared panel" but a handle to reference the panel. The panel that gets loaded into memory using LoadPanel is tcptelnet.uir.

 

Assume that you have two or more panels in memory... how do you tell your functions such as SetCtrlAttribute which panel is meant - you use a panel handle, which in this example is called gPanel.

 

Hope it helps a bit.

0 Kudos
Message 2 of 4
(4,341 Views)

Hi, many thanks.Cat Happy

 

So does that mean gPanel serve as a handle to load the .uir file when called LoadPanel?

 

Also, what is Parent Panel Handle? In what case should we input '0' in it?

 

 

LoadPanel.JPG

 

To go deeper, I notice there is 'Conversation Handle' in the ClientTCPRead.

What is the meaning of it apart from other 'Handle'?

 

ClientTCPRead.JPG

 

 

 

 

0 Kudos
Message 3 of 4
(4,331 Views)

Since your topic is called Panel I restrict myself to the panel related questions Smiley Wink

 

1) After the panel has been loaded using LoadPanel you can reference this panel using the panel handle; the handle is not needed to load the panel, just to reference it later.

 

2) Have a look at the help about child and parent panels and the LoadPanel function: a child panel is restricted in several aspects, e.g., it can reside only in the region defined by the parent panel; when loading a panel the first parameter tells if the UI file loaded into memory will be an independent (parent) panel, or a dependent child panel: the panel will be a top-level panel if you specify "0", it will become a child panel if you specify the panel handle of another, top-level / parent panel.

0 Kudos
Message 4 of 4
(4,327 Views)