07-11-2012 12:33 PM
In the CVI .uir editor there is often a '?' icon in the title bar which you can use to mouseover a field to display some help text.
How do I implement something like this in my CVI program?
Thanks!
Angie
07-11-2012 11:26 PM
One possible alternative in a CVIprogram is to use tooltips: see SetCtrlTooltipAttribute function help for an explanation on how they work.
07-12-2012 08:26 AM
If not a CVI solution, then is there a way to do this with a Win SDK function?
I'm just looking for a clue to point me in the right direction.
Thanks!
Angie
07-12-2012 11:20 AM
Angie,
As Roberto suggested, you can use tooltips to display helpful information to the user when they hover over a control.
The following article has more information: KnowledgeBase: Can I Create Tool Tips in LabWindows/CVI?
07-12-2012 11:26 AM
Thanks for the info.
I may end up using tooltips, but what I really wanted was the '?' icon on the toolbar. I did actually figure that part out (it puts the '?' icon up and changes the cursor when clicked on), now I'm just trying to try to figure out how to detect it when the operator clicks the '?' cursor over a control.
Angie
05-18-2020 05:38 PM
Hi Angie
Sorry to drag this up after more than 7 years but I am looking to do similar to what you describe.
However I have not been able to work out how to put the ? icon on the title bar.
Please could you let me know how you did it? I have been searching for quite a while and cannot seem to hit on any kind of solution, example or guide. I am probably not using the right keywords.
Did you manage to get it to work in the end?
Thanks in advance
Anand
05-19-2020 08:43 AM
Hi Anand,
Has it been 7 years? Yes I did finally get it to work, but I currently do not have access to the machine I developed the code on. I may be able to access it next week, and if so I will reply again to this topic. I wish I could remember what I did, but it's been so long. I think I had to use the Windows SDK and change the title bar settings from there. If I remember right, you can get the actual windows handle from a LabWindows function and use it to access the underlying SDK calls.
Hope that helps and hopefully I'll get back to you soon.
Angie
05-19-2020 08:55 AM
Hi Angie
Thank you for your quick reply - after so long I thought it really was a long shot. Your reply is much appreciated.
Apologies for v.quick re-reply - I just happened to be in front of my computer when your reply came in.
I appreciate it has been a long time and anything you can do to help, if and when you are able to access the machine in question, would be most welcome.
Pointing me to the use of the Windows SDK is a good starting point. I have dabbled in getting the underlying window handle in the same project as I am trying to apply the question mark for things like access to message boxes - so doing so doesn't frighten me.
Again, thank you for your quick reply - I will let you know how I get on.
Thanks
Anand
05-19-2020 04:07 PM
As per getting the associated window handle GetCVIWindowHandle is the function to use.
05-26-2020 08:40 AM
Hi Anand,
I found my code...here's the lines that put the question mark up.
____________________________________
int winHandle=0;
int postingHandle;
GetPanelAttribute (panel, ATTR_SYSTEM_WINDOW_HANDLE, &winHandle);
SetWindowLongPtr ((HWND)winHandle, GWL_EXSTYLE, WS_EX_CONTEXTHELP);
//Catch the windows message WM_NCLBUTTONDOWN for this panel (which means a non-client area of the
//window was clicked. The callback function will verify that it's the '?' icon.
InstallWinMsgCallback (panel, WM_NCLBUTTONDOWN, UTIL_HelpCallback, VAL_MODE_IN_QUEUE, NULL, &postingHandle);
____________________________________
The callback looks like this...
_____________________________________
int CVICALLBACK UTIL_HelpCallback (int panelHandle, int message, unsigned int* wParam, unsigned int* lParam, void* callbackData)
if (*wParam == HTHELP)
{
<code>
}
return 1;
_____________________________________
I have a note that you can't use the '?' if the 'min' or 'max' buttons are used.
Sorry if there are typo's etc...I couldn't cut/paste - had to retype.
Hope this helps!
Angie