|
Hi
In order to help, I've built a CTreeView-derived view to play with and have found;
Right-clicking doesn't expand tree items in my test app (??) - might be the version of common controls I'm using, but more importantly, I've overridden the OnLButtonDown member in the view, like so;
void CTreeTestView::OnLButtonDown(UINT nFlags, CPoint pnt)
{
UINT uFlags = 0;
HTREEITEM hSelectedItem = GetTreeCtrl().HitTest(pnt, &uFlags);
switch (uFlags)
{
case TVHT_ONITEMLABEL:
//mk GetTreeCtrl().SelectItem(hSelectedItem);
return;
}
_RPT3(_CRT_WARN, "## LButtonDown (x=%d, y=%d) returns %x\n", pnt.x, pnt.y, uFlags);
CTreeView::OnLButtonDown(nFlags, pnt);
}
which then gobbles the click whenever you click on the label, and everything else, like clicking on the expand button (plus/minus sign) works in the default way.
The bottom-line;
you can override the mouse clicks for your tree control in the standard way (WM_LBUTTONDOWN, et al message handlers) - where you can then use the CTreeCtrl::HitTest member to determine on which part of the tree the click occured, and then take the appropriate action.
In this fashion, you might even be able to customise right-clicks, etc.
HTH
Martin
PS: You might find that since the tree control's behaviour is more for black-box use than customization, you'll probably have to re-implement a lot of the basics over again - you'll have to see how much the effort's worth it.
|
|
|
|
|
What to say...
- A PREFECT ANSWER!!
Thanks!!
_____________________________
...and justice for all
APe
|
|
|
|
|
I am doing a program whereby Im creating an application that extracts information from MS Access Database and displays it out in Visual C++6.
I am using the ODBC Database method.
What I am trying to do is to input and also display Chinese characters in VC++6. The information in my MS Access Database are also in Chinese.
So far what I have only comes out as "???" (question marks!)
Yes I have installed MFC unicode libraries
I have also defined _UNICODE.
I hope the kind and clever people here would sincerely help me.
Thanks so much.
|
|
|
|
|
This might seem silly, but have you made sure that the font that you are using to display your text supports Chinese UNICODE characters?
Otherwise you will get those "???" marks you have mentioned.
I find Tahoma or Arial Unicode are safe fonts when it comes to this respect.
I Dream of Absolute Zero
|
|
|
|
|
erm how do i ensure that my font is Unicode enabled?
I also forgot to mention that my code is self-generated by the VC++ and I didnt type in a single code just some minor additions and adjustments that i followed from a book but those came out fine in English.
I was wondering if my problem had something to do with the codes.
Do i have to change anything?
|
|
|
|
|
I guess you have to Install support for East Asian Languages. This can be done from Control Panel->Regional Languages and Options
Hopefully this will fix it.
Still Alone in this beautiful world
My Articles
|
|
|
|
|
Hi. I did install those East Asian languages that you mentioned but to no avail.
I also forgot to mention that my code is self-generated by the VC++ and I didnt type in a single code just some minor additions and adjustments that i followed from a book but those came out fine in English.
I was wondering if my problem had something to do with the codes.
Do i have to change anything?
Thanks in advance.
|
|
|
|
|
Syasya Mortensen wrote:
my code is self-generated by the VC++
In that case, I guess your code is not unicode enabled. To do this, go to project settings and in General tab, change Character set to Unicode Character set. You will have to rebuild your project after doing this change.
BTW, to confirm that your support for chinese is installed, try opening some chinese website in your browser OR you said that your access database contains chinese strings. Try to open the DB in access and see if it displays chinese characters.. If it displays chinese OK, then try the above-mentioned.
Still Alone in this beautiful world
My Articles
|
|
|
|
|
Hmm sorry to be sounding so silly, but under my project->settings->General tab erm there is no options or wherever that i can change Character set to Unicode set. There doesnt seem to be any options for this.
Yup, my chinese characters do appear in my database and also in chinese websites so i guess theres no problem there.
I still seriously think its something to do with the codes?
Gaaah...!
|
|
|
|
|
Which version of Visual C are u using. I have got Visual C 7.1 (Visual studio 2003) and these settings are available there as I said. And I have checked it for Visual C 7.0 as well. It's available at a similar place there as well.
Still Alone in this beautiful world
My Articles
|
|
|
|
|
|
Is Visual Studio 7.0 Visual Studio C++.NET?
Are the compiler options there?
Under the Language property page?
Thanks.
|
|
|
|
|
OK now i got the configuration for both VC 7 and VC 6.
For VC 6
Go to Project Settings . C++. Change category to Preprocessor and add _UNICODE in Preprocessor definitions. Then go to Link. Change Category to Output and put wWinmainCRTStartup as Entry-point symbol.
For VC7 or VC.NET
Go to Project Properties. In General, change Character set to "Use Unicode Character Set". In C/C++ -> Preprocessor Definitions, Add _UNICODE. In Linker->Advanced. In Entry point, put wWinMainCRTStartup as Entry point.
I Hope now this works for both VC6 and VC7.
Regards
Still Alone in this beautiful world
My Articles
|
|
|
|
|
I have already configured all the things that you have mentioned. When I compile my codes, there are no errors and no warnings but the output display is still as question marks. (???)
I just recently installed VC.NET in the hopes of getting a solution.
Is .NET and C# the same thing?
|
|
|
|
|
Hi,
does anyone know how can I remove some of the functions that the shut down dialog box of Windows XP has?
For example how can I remove the "Restart" function?
Thanks in Advance
sirtimid
|
|
|
|
|
Hi
I believe the correct way to do this is implement your own GINA dll (search for GINA in the MSDN).
HTH
Martin
|
|
|
|
|
I think just modify some registry key to reach your goal.
|
|
|
|
|
hi,
can anyone help me with Reminder application source code
|
|
|
|
|
With what part, specifically?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi,
i have maintained all my Reminder info in records..say m_pSet->ReminderDate....etc...
problem for me i cant get a logic...
I am using onTimer() function in which i want a logic so that i may search for created records(say for nrecords) everytime and whenever i found the Exact match with syatem date and time,i must popup put a msg...can u help me
|
|
|
|
|
Hello Friends,
Please tell me which file is modified if I modify the project settings by pressing Alt+F7
Thanks in advance.
Neelesh K J Jain.
|
|
|
|
|
Neelesh K J Jain wrote:
Please tell me which file is modified if I modify the project settings by pressing Alt+F7
Project.DSP
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
|
Hello Friends,
I don't to display the Horizontal scroll bar in the ListView of my application. I am displaying some images and whenever I resize the window sometimes Horizontal scroll bar is displayed, So I tried using ShowScrollBar(SB_HORZ,FALSE) member function then the View is flickering whenever the scrollbar is being disabled. I got known the reason for the flickering as I am using CustomDraw() member function also.
Please help me in making the horizontal scroll bar to disappear without removing the customdraw member function.
thanks in advance.
Neelesh K J Jain.
|
|
|
|
|
I want to be able to call a function from a derived class in a base class function using pointer to this function. Example using reinterpret_cast follows, but it does not compile using mingw So maybe someone can explain me what I can do in this situation? Maybe I can use function objects, if yes, then how and what would serve the best? Thanks in advance!
#include <iostream>
// forward declaration
struct func_struct;
class data {};// base data class
class mydata : public data // new data class
{
public:
int i; // one class member
};
class base // main functionality
{
public:
virtual func_struct* get_func()=0;
void dothings(data* pData);
};
typedef void (base::*func)(data *);
struct func_struct
{
func pfunc;
};
void base::dothings(data* pData)
{
func_struct* fs=get_func();
// how to get the pointer???
(this->*fs.pfunc)(pData);
};
// specific functions
class child : public base
{
public:
virtual func_struct* get_func()
{
static func_struct maping;
// how to store pointer???
maping.pfunc=reinterpret_cast<func>(my_func);
return &maping;
}
void my_func(mydata* p)
{
p->i=1;
}
};
int main(int argc, char *argv[])
{
mydata d;
std::cout<<d.i<<std::endl; // should be 0
child c;
c.dothings(&d);
std::cout<<d.i<<std::endl; // should be 1
return 0;
}
Regards,
Alexander.
|
|
|
|