|
I'm not sure that I understand your query right, but you're probably pressing F11 instead of F10?
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
What i mean is when the CString is part of an function call.
When i try to step into the function first all of the Cstring constructors
comes with assembler code.
void function(CString xy,CString xy,CString xy)
{
}
F11
first CString assembler, sec. CString assembler,..., enter function...
|
|
|
|
|
you could press ctrl + tab and it'll restore the nature view
|
|
|
|
|
Hi,
This is not the proper forum for my question.But i dont know where to post it.sorry.
Iam planning to use WPF controls in my MFC application.Either directly or by creating DLL in C#.
But i dont know anything about that.Is there any book to buy about WPF and VC++.
Pls provide me any information on that.
Just i want is..the look of WPF like buttons,colored Listbox,colored Dialog.But functionality of all buttons should come in MFC applcaition only.
Anu
|
|
|
|
|
|
Hi,
After some struggle, and some good help from this forum, I find that I am now more or less managing to be able to manage my owner draw list box, except for 1 issue.
The strings I want to use contain tabs.
When I set my CreateStruct up in my PreCreateWindow, I have to disable LBS_MULTICOLUMN or my custom DrawItem function does not get called.
The downside of disabling the LBS_MULTICOLUMN is that the tabs in the string are discarded and my formatting goes to pot, even when configuring LBS_USETABSTOPS.
Any Suggestions?
TIA
Tony
|
|
|
|
|
maycockt wrote: ...even when configuring LBS_USETABSTOPS.
Did you send the control a LB_SETTABSTOPS message?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I hadn't sent a LB_SETTABSTOPS message, but I had used SetTabStops funtion, which had no effect.
In my OnInitDialog I have tried the following......
<per>
m_plbMyControl = new CCustomListBox();
if(NULL != m_plbMyControl )
{
CRect rList(10, 10, 580, 285);
DWORD dwStyle = LBS_NOTIFY | LBS_OWNERDRAWVARIABLE | LBS_NOINTEGRALHEIGHT | LBS_HASSTRINGS | LBS_USETABSTOPS | WS_BORDER | WS_HSCROLL;
if(TRUE == m_plbMyControl->Create(dwStyle, rList, this, IDC_LIST_CONTROL))
{
//m_plbMyControl->SetTabStops(16);
::SendMessage(m_plbMyControl->m_hWnd, LB_SETTABSTOPS, (WPARAM)1, (LPARAM)16);
}
}
Whereas the SetTabStops call had no effect, the ::SendMessage just gets an unhandled exception.
I am sure the SetTabStops or LB_SETTABSTOPS is the right way to go, I just cant seem to work out how to use it properly!!!
Any further help would be much appreciated.
TIA
Tony
|
|
|
|
|
maycockt wrote: //m_plbMyControl->SetTabStops(16);
::SendMessage(m_plbMyControl->m_hWnd, LB_SETTABSTOPS, (WPARAM)1, (LPARAM)16);
Just to see if the tabstops are even being used, have you played around with other values besides 16? Four character units does not seem large enough to separate anything but very small (1-2 characters) words.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I've tried 0, 1, 4, 8, 16........
Each time using ::SendMessage it crashes with an Unhandled Exception.
TIA
Tony
modified on Thursday, December 3, 2009 10:06 AM
|
|
|
|
|
maycockt wrote: I've tried 0, 1, 4, 8, 16........
(I think) You need to use larger values, not smaller.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
A value of 16 should give 4 display units I believe, so bigger than that would cause larger gaps in my spacing?
I don't understand why the ::SendMessage is failing though, each time it falls over in the first ::CallWidnowProc of DefWindowProc, i.e. m_pfnSuper is valid.
I can use a WPARAM of 0, and a LPARAM of NULL and it doesnt fail, but the ListBox still ignores TabStops.....
I'm beginning to think a redesign using a list control and hidden HeaderCtrl might be the way to go........
Tony
modified on Thursday, December 3, 2009 10:45 AM
|
|
|
|
|
maycockt wrote: A value of 16 should give 4 display units I believe, so bigger than that would cause larger gaps in my spacing?
Yes, of course. The intent was to see if the tabstops were even working. At this point, you don't know if the tabstops are just not large enough, or if the LBS_USETABSTOPS style is being ignored, or if the LB_SETTABSTOPS message is wrong.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi David,
That probably was more blunt than I intended. I was more sort of querying that my understanding was correct of the dimensions.
The LBS_USERTABSTOPS I would guess is being ignored, probably because of one of the other settings.
Incidentally, would SetTabStops(16) have the same effect as the SendMessage()?
I would have thought it should.
Thanks for your help so far
Tony
|
|
|
|
|
maycockt wrote: The LBS_USERTABSTOPS I would guess is being ignored, probably because of one of the other settings.
That's easy enough to test. Create a non-ownerdraw listbox, and call AddString() to add the strings to it. If that works, then the problem likely has to do with the LBS_OWNERDRAWVARIABLE style.
maycockt wrote: Incidentally, would SetTabStops(16) have the same effect as the SendMessage()?
Yes. The former is just a convenient wrapper around the latter.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Having removed the LBS_OWNERDRAWVARIABLE the formatting is using the tabs appropriately, but with that I am back to square 1 of needing to intercept the drawing as I need to have some of the text emboldened.
Do you think then that my style settings must be wrong?
I currently rule out and include in the PreCreateWindow as follows
<per>
// Turn off disallowed styles
cs.style &= ~( LBS_SORT |
LBS_OWNERDRAWFIXED |
LBS_MULTICOLUMN);
// Turn on mandatory styles
cs.style |= ( LBS_NOTIFY |
LBS_HASSTRINGS |
LBS_OWNERDRAWVARIABLE |
LBS_NOINTEGRALHEIGHT |
LBS_USETABSTOPS |
WS_BORDER );
Anything I am missing?
Tony
|
|
|
|
|
Are you calling TextOut() in the CCustomListBox::DrawItem() method? If so, try calling TabbedTextOut() instead. Also, the call to SetTabStops() seems to be unnecessary.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi David,
Thanks for your help.
TabbedTextOut was the solution to achieve what I wanted. I'm still a bit confused why LB_USETABSTOPS wasnt working, but hey ho - we have what the moeny men want now.
Thanks again
Tony
|
|
|
|
|
Um, it's owner-draw. You're the one doing the drawing. If it's not drawing the way you want, then fix your drawing code.
|
|
|
|
|
Thanks for your wonderful pearls of wisdom.
It must be nice to know everything and never be in need of asking a question, especially when helpful suggestions made don't bear fruition.
I had an issue, I asked a question, and someone was kind enough to work with me to get a result. Is that not what these forums are about?
|
|
|
|
|
Sorry, I thought I was being helpful: You have an owner-draw listbox. Therefore, you are doing the drawing. If it's not drawing the way you want, then you need to look more carefully at your drawing code. Since you didn't post your drawing code, it's not clear what further assistance was possible.
|
|
|
|
|
I doubt it's part of the problem, but is there any reason why you are creating a heap-based CCustomListBox object?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi David,
The answer to that question is that my DIalog design wasn't working, and I was wondering whether it was to do with creation etc, and I didnt go back to it yet.
As I'm getting the same results as with my original design, I will go back to it.
Either way, the tab stops dont seem to want to work
Tony
|
|
|
|
|
Hello All
I getting exception while I use
mysql_fetch_field .I use debug then I found when table rows is more than 229000 then Iam getting exception in this line
field1=mysql_fetch_field(res1); .
Unhandled exception at 0x10010d74 in SQLconvert.exe: 0xC0000005: Access violation reading location 0x00000040.
Call stack shows
libmySQL.dll!10010d74()
[Frames below may be incorrect and/or missing, no symbols loaded for libmySQL.dll]
> SQLconvert.exe!CSQLconvertDlg::EnumRow(ATL::CStringT<char,StrTraitMFC<char,ATL::ChTraitsCRT<char> > > tab="sheet1") Line 1400 + 0xc bytes C++
SQLconvert.exe!CSQLconvertDlg::Convert() Line 1147 C++
SQLconvert.exe!readThread(void * p=0x0012f254) Line 56 C++
SQLconvert.exe!_AfxThreadEntry(void * pParam=0x0012e5c0) Line 109 + 0xf bytes C++
SQLconvert.exe!_callthreadstartex() Line 348 + 0xf bytes C
SQLconvert.exe!_threadstartex(void * ptd=0x003fd628) Line 331 C
kernel32.dll!7c80b699()
code is here
QueryResultsPtr Qry;
MYSQL_FIELD *field1;
MYSQL_RES *res;
enum enum_field_types type;
if (!mysql_query(conn," SELECT * FROM tes"))
{
res = mysql_store_result(conn) ;
int numrows = (int)mysql_num_rows(res);
int numflds = (int)mysql_num_fields(res);
while (row = mysql_fetch_row(res))
{
res1=mysql_list_fields(conn,tab,"%");
for(long y=0; y<numflds; y++)
{
str2.Empty();
field1=mysql_fetch_field(res1);
if(field1->flags & AUTO_INCREMENT_FLAG)
continue;
str2+=(LPTSTR)row[y];
type=field1->type;
}
}
}
|
|
|
|
|
It may be a bug, but I don't think that you need to SELECT * from the huge table, why do not where something to reduce fetched rows?
try to use mysql_use_result() rather than mysql_store_result() to see if the problem can be fixed.
BTW: mysql_num_rows() is invalid if using mysql_use_result().
|
|
|
|