|
Hi all,
We have a class CBitmapButton which is derived from cButton. We need to enable the tool tip for this class. We have written the code for the same.
We have followed all the steps required to enable a tool tip for this button. However we are facing a problem while displaying the tool tip. The tool tip is seen at first when the mouse is moved to this button. If we hold the mouse on that button, after some time, the tool tip vanishes and then the tool tip is never seen even if the mouse is moved to the next button and brought back to this button .
Please suggest some solution to the above problem.
Any kind of help would be appreciated.
Thanks
amit
|
|
|
|
|
can you give he short code snippet what you are doing so that someone can find out where you are gong wrong
Cheers
"Peace of mind through Technology"
|
|
|
|
|
|
Hi all,
Thanks for the help. I tried the following things one by one and checked the output
1. Capture the mouse event and used TrackMouseEvent
2. Called InitToolTip function in PreTranslate before RelayEvent
3. Set the flag to TTF_SUBCLASS while creating the tool tip control.
However, I am still not getting the tool tip after the time out.
I shall post my code in a short while. Please look at it and let me know what is wrong in it
Thanks again for the help provided.
Regards,
amit
|
|
|
|
|
Given below are the steps for enabling the tool tip for the CBitmapButton
1. The class CTipBitmapButton is derived from CButton. This has teh owner's draw property set to TRUE.
2. An object of CToolTipCtrl m_ToolTipCtrl is created.
3. m_ToolTipCtrl is initialised in the constructor
4. The tool tip is initialised by using following code:
m_ToolTipCtrl = new CToolTipCtrl;
m_ToolTipCtrl->Create(this);
m_ToolTipCtrl->Activate(TRUE);
m_ToolTipCtrl->SetFont(GetFont(), FALSE);
5. New function DisplayToolTip is called in the DrawItem function of the class CTipBitmapButton
6. The function DisplayToolTip has the following code
a. Delete the tool tip if it exists
b. Set the tool tip using SetToolTipText function
c. Set the delay time to TTDT-INITIAL
7. The function SetToolTipText has the following code
a. Initialise the tool tip
b. If the tooltip tool count is 0, then m_ToolTipCtrl->AddTool(this, rect, 1)
c. m_ToolTipCtrl->UpdateTipText(tooltext,this,1)
d. m_ToolTipCtrl->Activate(TRUE);
8. In PreTranslateMessage
m_ToolTipCtrl->RelayEvent(pMsg);
With this code, the tool tip does not come after the time out. Please suggest.
Any kind of help would be appreciated.
Thanks,
amit
|
|
|
|
|
Given below are the steps for enabling the tool tip for the CBitmapButton
Please note that this code is the original code written before trying out options of TrackMouseEvent and TTF_SUBCLASS
1. The class CTipBitmapButton is derived from CButton. This has teh owner's draw property set to TRUE.
2. An object of CToolTipCtrl m_ToolTipCtrl is created.
3. m_ToolTipCtrl is initialised in the constructor
4. The tool tip is initialised by using following code:
m_ToolTipCtrl = new CToolTipCtrl;
m_ToolTipCtrl->Create(this);
m_ToolTipCtrl->Activate(TRUE);
m_ToolTipCtrl->SetFont(GetFont(), FALSE);
5. New function DisplayToolTip is called in the DrawItem function of the class CTipBitmapButton
6. The function DisplayToolTip has the following code
a. Delete the tool tip if it exists
b. Set the tool tip using SetToolTipText function
c. Set the delay time to TTDT-INITIAL
7. The function SetToolTipText has the following code
a. Initialise the tool tip
b. If the tooltip tool count is 0, then m_ToolTipCtrl->AddTool(this, rect, 1)
c. m_ToolTipCtrl->UpdateTipText(tooltext,this,1)
d. m_ToolTipCtrl->Activate(TRUE);
8. In PreTranslateMessage
m_ToolTipCtrl->RelayEvent(pMsg);
With this code, the tool tip does not come after the time out. Please suggest.
Any kind of help would be appreciated.
Thanks,
amit
|
|
|
|
|
Hi all,
I am sending you the code snippet i have written.
Hope you will get better idea with this.
Given below are the steps for enabling the tool tip for the CBitmapButton
1. The class CTipBitmapButton is derived from CButton. This has teh owner's draw property set to TRUE.
2. An object of CToolTipCtrl m_ToolTipCtrl is created.
3. m_ToolTipCtrl is initialised in the constructor
4. The tool tip is initialised by using following code:
m_ToolTipCtrl = new CToolTipCtrl;
m_ToolTipCtrl->Create(this);
m_ToolTipCtrl->Activate(TRUE);
m_ToolTipCtrl->SetFont(GetFont(), FALSE);
5. New function DisplayToolTip is called in the DrawItem function of the class CTipBitmapButton
6. The function DisplayToolTip has the following code
a. Delete the tool tip if it exists
b. Set the tool tip using SetToolTipText function
c. Set the delay time to TTDT-INITIAL
7. The function SetToolTipText has the following code
a. Initialise the tool tip
b. If the tooltip tool count is 0, then m_ToolTipCtrl->AddTool(this,
rect, 1)
c. m_ToolTipCtrl->UpdateTipText(tooltext,this,1)
d. m_ToolTipCtrl->Activate(TRUE);
8. In PreTranslateMessage
m_ToolTipCtrl->RelayEvent(pMsg);
With this code, the tool tip does not come after the time out. Please suggest.
amit
|
|
|
|
|
If you are manually passing mouse movement messages to the tooltip, be sure that you are doing it from the parent window of the CBitmapButton , and not from the button control itself, or use _TrackMouseEvent(...) to indicate to the tooltip control when you have moved off of the button (send it a POP message).
My guess is that the tooltip is not getting messages when you move off of the control, so it still thinks the mouse is over the button (standing still), and will not reset its state to display itself again.
Alternately, you could use a little-known (or little-used) feature of the ToolTip control, the TTF_SUBCLASS flag when creating the tooltip to implement "fire-and-forget" tooltip support, where you do not have to handle passing messages around.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
|
how can i monitor all register sub keys in the selected root regiter key.
and display the register key name,value ans status in list control.
how can i do it?
|
|
|
|
|
|
You can use :
char lszValue[255];
CString str ;
HKEY hKey;
LONG returnStatus;
DWORD dwType=REG_SZ;
DWORD dwSize=255;
returnStatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Key path separeted by \\", 0L, KEY_ALL_ACCESS, &hKey);
if (returnStatus == ERROR_SUCCESS)
{
returnStatus = RegQueryValueEx(hKey,"value you want to read", NULL, &dwType,(LPBYTE)&lszValue, &dwSize);
if(returnStatus == ERROR_SUCCESS)
{
str = (LPCTSTR)lszValue;
}
}
RegCloseKey(hKey);
Cheers
"Peace of mind through Technology"
|
|
|
|
|
kiranin wrote: how can i monitor all register sub keys in the selected root regiter key.
By using RegNotifyChangeKeyValue() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Plz Can U explain the procedure......how i willl do it.?
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
PabloN wrote: ...when i move my groupbox the radio button won't.
This is normal behavior with VS v6. Has that changed with VS 2005?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I build a dialog based MFC program.
in the file "StdAfx.h" I add the following code,which is used to define a global variable of type CString .
#ifndef jjjjjjjjjjjjjjjjjjj
#define jjjjjjjjjjjjjjjjjjj
CString StrGlobal;
#endif
and then I use it in another file "newfile.cpp"
#include "stdafx.h"
extern CString StrGlobal;
void fun()
{
StrGlobal = _T("KDKDK");
}
when I build the program, following link error shows up:
Linking...
StdAfx.obj : error LNK2005: "class CString StrGlobal" (?StrGlobal@@3VCString@@A) already defined in newfile.obj
why dose this happen? and how can I fix it ?
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
You've got the extern in the wrong file: It should be in the .h file.
Steve
|
|
|
|
|
I build a dialog based MFC program.
in the file "StdAfx.h" I add the following code,which is used to define a global variable of type CString .
#ifndef jjjjjjjjjjjjjjjjjjj
#define jjjjjjjjjjjjjjjjjjj
CString StrGlobal;
#endif
and then I use it in another file "newfile.cpp"
#include "stdafx.h"
extern CString StrGlobal;
void fun()
{
StrGlobal = _T("KDKDK");
}
when I build the program, following link error shows up:
Linking...
StdAfx.obj : error LNK2005: "class CString StrGlobal" (?StrGlobal@@3VCString@@A) already defined in newfile.obj
why dose this happen? and how can I fix it ?
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
move the declaration
CString StrGlobal; to stdafx.cpp or make the varaiable static
nave
|
|
|
|
|
yes, I make it static and it works. thank you so much.
but ,could you please explain to me briefly the reason?
-------------------
I am learning C++ and English
|
|
|
|
|
The .h file might have been include by multiple cpp file. so while compiling , the variable will be present in the vtable of obj file corresponding to each cpp. so while linking, linker will find multiple object and generates the error since it dosen't know to which obj it have to link.
nave
|
|
|
|
|
ewighell wrote: #ifndef jjjjjjjjjjjjjjjjjjj
#define jjjjjjjjjjjjjjjjjjj
CString StrGlobal;
#endif
#ifndef jjjjjjjjjjjjjjjjjjj
#define jjjjjjjjjjjjjjjjjjj
extern CString StrGlobal;
#endif
ewighell wrote: #include "stdafx.h"
extern CString StrGlobal;
void fun()
{
StrGlobal = _T("KDKDK");
}
#include "stdafx.h"
CString StrGlobal;
void fun()
{
StrGlobal = _T("KDKDK");
}
Nibu thomas
Software Developer
|
|
|
|
|
For backup purpose Windows OS makes an Emergency Repair Disc(ERD) through Windows Backup Utility.In That
it makes a folder named RegBack, where it copies all registry values to files. I want to do the exactly same in my
program through VC++. Can anybody give me some direction please.I need help
nirmal
|
|
|
|
|
Hi
you can use the shellExecute for invoking the backup process from your VC++ apllication.
For windows Xp: you can call ShellExecute on rstrui.exe
For Windows 2000: you can call ShellExecute on ntbackup.exe
Cheers
"Peace of mind through Technology"
|
|
|
|