03-27-2007 09:41 PM
03-28-2007 05:15 AM
Hello there,
quite a lot you are asking But it is indeed important to make your User Interface look a little bit professional.
I attached a small example project to show you how to respond on mouse position. Therefore, the EnableExtendedMouseEvents function is used on the button control, to enable the callback function to be called with the EVENT_MOUSE_MOVE event. Then, all you have to do is check if the mouse is over the button or not, and adjust the label style. Just check the example code and you will see that it's actually quite easy.
Now, for the tab pages: I'm afraid that it is not possible to add a close button to each tab page (at least not on the tab button itselft). A solution would be to put it on another location on the tab page, with the small drawback that the user has to activate the tab page before it can be closed.
CVI 8.0 and higher versions have a built-in tab control. There, it is possible to create a scroll control when to many tab pages are created. If you have a lower CVI version, maybe you migh consider working with ActiveX Tab Controls, provided by Microsoft (Microsoft TabStrip Control). I have never used these controls, but they might have the functionality that you are looking for. To use these, open your uir file, drop down the Create menu (or right-click your panel) and select ActiveX.
Good Luck
03-28-2007 11:56 AM
03-28-2007 07:59 PM
03-29-2007 10:31 AM
Hmm, I'm not sure what you mean by placing template panels on the tab control and then hiding them. I suspect that you would be able to do what you need to do using InsertTabPage and CopyTabPage (and maybe with a little bit of ingenuity). However, the new function InsertPanelAsTabPage was added in 8.1, which allows you to add any existing panel to a tab control as a tab page. This sounds like exactly what you were describing.
As far as the hyperlink behavior, a panel callback like this would do the trick....
int CVICALLBACK PanelCB (int panel, int event, void *callbackData,
int eventData1, int eventData2)
{
Rect rect;
switch (event)
{
case EVENT_MOUSE_POINTER_MOVE:
GetCtrlBoundingRect(panel, PANEL_TEXTMSG,
&rect.top, &rect.left, &rect.height, &rect.width);
if (RectContainsPoint(rect, MakePoint(eventData2, eventData1)))
{
SetCtrlAttribute(panel, PANEL_TEXTMSG, ATTR_TEXT_COLOR, VAL_BLUE);
SetCtrlAttribute(panel, PANEL_TEXTMSG, ATTR_TEXT_UNDERLINE, 1);
}
else
{
SetCtrlAttribute(panel, PANEL_TEXTMSG, ATTR_TEXT_COLOR, VAL_BLACK);
SetCtrlAttribute(panel, PANEL_TEXTMSG, ATTR_TEXT_UNDERLINE, 0);
}
break;
case EVENT_CLOSE:
QuitUserInterface (0);
break;
}
return 0;
}
Hope this helps,
- jared
03-29-2007 09:20 PM - edited 03-29-2007 09:20 PM
帖子被Whatcall在03-29-2007 09:21 PM时编辑过了
03-30-2007 10:57 AM
04-01-2007 08:14 PM - edited 04-01-2007 08:14 PM
帖子被Whatcall在04-01-2007 08:14 PM时编辑过了