LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Easytab display problems

I am using LabWindows 5.0. I am using EasyTab to make tabbed panels on the main panel. When I resize the main panel, I also resize the tabbed panels. When this happens, the rows of tabs are sometimes shown distorted - as if the text was magnified. Clicking on the tabs restores them, but the distorted image is still visible to the right of the tabs. Is there any way around this? I have not been able to find any information about this problem anywhere else. I modified the demo project and it also has the same problem. Here is my simpdemo.c file, you will need to edit the main panel to be sizable and give it the callback function PANEL_callback:


#include /* Needed if linking in external compiler; harmless otherwise */
#include
#include "easytab.h"
#include "simpdemo.h"

int tabCtrl,tabheight,tabwidth;

int main (int argc, char *argv[])
{
int panel;

if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless otherwise */
return -1; /* out of memory */

panel = LoadPanel(0, "simpdemo.uir", PANEL);

/* Two function calls and, Voila!, a tab sheet dialog */
tabCtrl = EasyTab_ConvertFromCanvas(panel, PANEL_CANVAS);
EasyTab_LoadPanels (panel, tabCtrl, 1, "simpdemo.uir", __CVIUserHInst, CONTROL, 0,
VALVES, 0, MONITOR, 0, CONFIG, 0, HELP, 0, 0);

DisplayPanel(panel);
//save the default canvas size
GetCtrlAttribute (panel,PANEL_CANVAS, ATTR_HEIGHT, &tabheight);
GetCtrlAttribute (panel,PANEL_CANVAS, ATTR_WIDTH, &tabwidth);
RunUserInterface();

return 0;
}

int CVICALLBACK DoneCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
if (event == EVENT_COMMIT)
QuitUserInterface(0);
return 0;
}

int CVICALLBACK PANEL_callback (int panel, int event, void *callbackData,
int eventData1, int eventData2)
{
int i,h,w,hadj,wadj;
switch (event)
{
case EVENT_PANEL_SIZE:
//get the panel size
GetPanelAttribute (panel, ATTR_HEIGHT, &h);
GetPanelAttribute (panel, ATTR_WIDTH, &w);
//get the growth
h=h-360;
if (h<0)
h=0;
w=w-381;
if (w<0)
w=0;
//get the active tab panel
EasyTab_GetAttribute (panel,tabCtrl,ATTR_EASY_TAB_ACTIVE_PANEL, &eventData1);
//size the canvas
SetCtrlAttribute (panel,PANEL_CANVAS, ATTR_HEIGHT, tabheight+h);
SetCtrlAttribute (panel,PANEL_CANVAS, ATTR_WIDTH, tabwidth+w);
//size the active tab panel
SetPanelAttribute (eventData1, ATTR_HEIGHT, tabheight+h);
SetPanelAttribute (eventData1, ATTR_WIDTH, tabwidth+w);
//update the panels
DisplayPanel(eventData1);
DisplayPanel(panel);
break;
}
return 0;
}
0 Kudos
Message 1 of 5
(3,565 Views)
I encountered similar problem with an application I am developing in LabVIEW: sometimes when displaying a panel screen gets confused with a ribbon one third of the screen height with all pixels pasted together.
I spoke with NI and they told me that this kind of problems usually depends on some problems with the graphics card, and suggested me to reduce the hardware acceleration of the device (display properties, settings tab, advanced button, 'prestazioni' tab [sorry, I'm translating from italian...] and reduce the value of the slider). I reduced it and the problem was solved (till now: I think nobody really knows ALL what's happening inside our machines and which action or setting is able to produce an undefined behaviour somewhere...).

Maybe this can be your si
tuation too...

Hope this helps
Roberto


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?
0 Kudos
Message 2 of 5
(3,565 Views)
This is one solution. Make sure the 'Scale Contents on Resize'
attribute is set.


"kmagas" wrote in message
news:5065000000080000008B160000-983677784000@quiq.com...
> I am using LabWindows 5.0. I am using EasyTab to make tabbed panels on
> the main panel. When I resize the main panel, I also resize the tabbed
> panels. When this happens, the rows of tabs are sometimes shown
> distorted - as if the text was magnified. Clicking on the tabs
> restores them, but the distorted image is still visible to the right
> of the tabs. Is there any way around this? I have not been able to
> find any information about this problem anywhere else. I modified the
> demo project and it also has the same problem. Here is my simpdemo.c
> file, you will need to edit the main pa
nel to be sizable and give it
> the callback function PANEL_callback:
>

0 Kudos
Message 3 of 5
(3,565 Views)
Setting the display property to SCALE CONTENTS ON RESIZE for the main panel solves one problem and creates others. The tabs now redraw properly when the panel is sized larger. But I look at the panel size in my panel callback, if its too small I resize it up to a default setting. When this happens the tabs are all scrunched together and unreadable. I have not found a way to restore them, I tried displaying the all tabbed panels, and displaying the active tabbed panel, neither of which helps.
0 Kudos
Message 4 of 5
(3,565 Views)
kmagas:

If you'd like the Easy Tab control to grow with the panel, then the solution I would recommend is to remake the Tab Control whenever you need to resize it. This really isn't too difficult. I've attached some code that achieves this by calling a makeTab() function I wrote. This function creates a canvas and Easy Tab control and returns the handle to it. You can pass an old handle if the control already exists, and the function will destroy the old one for you.

If you don't want your Easy Tab control to grow with the panel, then you can just call the EasyTab_AutoSize() function in the panel callback. This will prevent the bizarre "ghost" image that appears on the panel otherwise.

I've attached the UIR and code files to this message. Good question;
I hope this helps.

Good Luck,

Chris Wood
Applications Engineer
National Instruments
Download All
0 Kudos
Message 5 of 5
(3,565 Views)