May 01, 2024, 05:01:44 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


How to use Ctooltip

Started by ExMember001, June 23, 2007, 08:17:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ExMember001

Hi,
i try to set tooltips to my controls, the problem is that i dont understand how to use it.
anyone can show me a little example on how to set a tooltip to a button? Please.

Bruce Peaslee

See tabctrl_demo2.src in the Aurora examples for usage.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

ExMember001

June 24, 2007, 02:18:10 PM #2 Last Edit: June 24, 2007, 02:25:33 PM by KrYpT
sorry but nothing related to ctooltip there ;)
my tooltips for my toolbar work but i want to set a tooltip to a simple button with the class ctooltip
how do i do that?

i'm initialising the tooltips after the button creation with
ctooltip tp;
tp.initialize(this);

then i'm adding an hint with addhint(...)
tp.AddHint(this, PButton_C, "Centrer le text");
but the tooltips doesnt show when my mouse hover the button

sapero

Hello, here's the simplest example:#include "windows.inc"
#include "commctrl.inc"

#define IDC_TT1 1000
#define IDC_TT2 1001

class CDlg:CDialog
{
declare OnInitDialog(),int;
declare OnClose(),int;
declare OnControl(int nID, int nNotifyCode, unsigned int hControl),int;
CTooltip m_tt;
}



global sub main()
{
CDlg dlg;
dlg.Create(0,0,300,98,0x80CB0880,0,"Tooltip Demo",0);
dlg.AddControl(CTBUTTON,"Tooltip 1",47,27,91,39,0x50010000,0x0,IDC_TT1);
dlg.AddControl(CTBUTTON,"Tooltip 2",169,28,91,39,0x50010000,0x0,IDC_TT2);
dlg.DoModal();
}



CDlg::OnClose(),int
{
CloseDialog(1);
}



CDlg::OnInitDialog(),int
{
m_tt.Create(0x80000000,0x80000000,0x80000000,0x80000000, WS_POPUP,0,"",this);
m_tt.AddHint(this, GetControl(IDC_TT1)->m_hwnd, "this is hint 1", TTF_IDISHWND | TTF_SUBCLASS);
m_tt.AddHint(this, GetControl(IDC_TT2)->m_hwnd, "this is hint 2", TTF_IDISHWND | TTF_SUBCLASS);
}



CDlg::OnControl(int nID, int nNotifyCode, unsigned int hControl),int
{
switch (nID)
{
case IDCANCEL:
OnClose();
}
}

ExMember001

thanx Sapero, i was near... my code was missing the TTF_IDISHWND|TTF_SUBCLASS
works great now using it with m_tt.Initialize(this); instead of create();