Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Creating Tool Tips

reidar_tyssen
Beginner
707 Views

I know this issue has been discussed in this forum some years ago, but from reading old threads is not possible to find a solution.

The problem: I am trying to enhance L. Normans example Toolbar by introducing tool tips. However, it will not work. The whole project is enclosed in the attached zip-file.

Can you help?

0 Kudos
7 Replies
Jugoslav_Dujic
Valued Contributor II
707 Views
You were almost there -- except that TBSTYLE_TOOLTIPS is a "plain" window style, not an extended one.

A stylistic nitpick: it's probably simpler to use hInst+string table ID than LoadString, i.e:

if(lpToolTipText%hdr%code == TTN_GETDISPINFOA)then
ptext = lparam
lpToolTipText%lpszText = lpToolTipText%hdr%idfrom
lpToolTipText%hinst = ghinstance
endif
0 Kudos
reidar_tyssen
Beginner
707 Views

Dear JugoslavDujic

You are overrating my Win-skills, I am still almost there.

Could you please be more specific?

Reidar

0 Kudos
Jugoslav_Dujic
Valued Contributor II
707 Views
I'm lazy to check the code back, but you had:
hToolbar = CreateWindowEx(TBSTYLE_TOOLTIPS...
where you should have:
hToolbar = CreateWindowEx(0, ...,IOR(WS_CHILD, TBSTYLE_TOOLTIPS)...
0 Kudos
reidar_tyssen
Beginner
707 Views

I understand creating the tool window should be:

hwndTB = CreateWindowEx (WS_EX_TOPMOST,TOOLBARCLASSNAMEA, &

""C, IOR(WS_CHILD, TBSTYLE_TOOLTIPS),50,100, 0, 0, hwnd,Null,&

ghInstance , NULL)

and this works fine!

The alternative highstyle code you proposeed in the case construct:

if(lpToolTipText%hdr%code == TTN_GETDISPINFOA)then

ptext = lparam

lpToolTipText%lpszText = lpToolTipText%hdr%idfrom

lpToolTipText%hinst = ghinstance

         endif

does not work at all, so I stick to the original.

An additional question:

Regarding the function CreateWindowEx , argument 1 specify TOPMOST style,

argument 5-6 which is set to 50 and 100, specify the position of the window.

Whatever I specify, the toolbar appears in the upper left corner

(could not paste the screen dumppicture into here.

Creating a second toolbar will then overlap the first, so how it is possible to

specify the position?

Regards

Reidar

0 Kudos
Paul_Curtis
Valued Contributor I
707 Views
I have never wanted to resize a tooltip (ie, the automated nature of the WinAPI functionality is the whole point of the feature), but this should be do-able in exactly the same manner as any other window. Here is how I create tooltips (the text is dynamic and is loaded elsewhere):

FUNCTION CreateToolTips (hParent) RESULT (hTT)
IMPLICIT NONE
INTEGER, INTENT(IN) :: hParent
INTEGER :: hTT, rval

! creates a ToolTips control as a child to hParent
hTT = CreateWindowEx (0, TOOLTIPS_CLASS, ""c, &
IOR(TTS_ALWAYSTIP,WS_POPUP), &
CW_USEDEFAULT, CW_USEDEFAULT, &
CW_USEDEFAULT, CW_USEDEFAULT, &
hParent, NULL, ghInstance, NULL)

rval = SetWindowPos (hTT, HWND_TOPMOST, 0,0,0,0, &
IOR(SWP_NOACTIVATE,IOR(SWP_NOMOVE,SWP_NOSIZE)))

rval = SendMessage (hTT, TTM_SETDELAYTIME, TTDT_INITIAL, &
MakeLong(INT2( 5),INT2(0)))
rval = SendMessage (hTT, TTM_SETDELAYTIME, TTDT_AUTOPOP, & MakeLong(INT2(3000),INT2(0)))
rval = SendMessage (hTT, TTM_ACTIVATE, TRUE, 0)

END FUNCTION CreateToolTips

0 Kudos
reidar_tyssen
Beginner
707 Views

Creating Tool Tips

The problem may be solved in the following steps:

1)Run the program residing in the release folder. Check tool tips at the Open and

Save buttons.

2)Repeat step 1 in Debug mode. Try to locate where to store the tool tip text.

Hint: Tool bar editor, check property prompt for the Open button.

3)What programming steps are required to make the toolbar appear in the middle of the

client window?

Hint: check questions and answers in this thread.

Are you the first one to solve the problems and check the code back?

Wish You a Merry Christmas

Reidar

0 Kudos
Reply