|
Hi there,
i hope that someone can help me with this.
My application is SDI.
I wroted a class derived from CListCtrl which is created with
LVS_OWNERDRAWFIXED style.
There is a strange behaviour when i click on a different subitem on the same
selected row. It seems that it takes 800 ms till DrawItem is called.
My class implements two methods:
void OnLButtonDown(...)
{
TRACE("Start OnLButtonDown...\n");
...
CListCtrl::OnLButtonDown(nFlags, point);
TRACE("End OnLButtonDown...\n");
}
void DrawItem(...)
{
TRACE("DrawItem...\n");
...
}
When i click at different rows i see in the debug window:
Start OnLButtonDown
DrawItem
DrawItem
..
..
End OnLButtonDown
Meaning, DrawItem is called before OnLButtonDown() finishes.
However, if i click on the same row again i see in the debug window:
Start OnLButtonDown
End OnLButtonDown
DrawItem
In that case, DrawItem is called 800 ms after OnLButtonDown finishes.
Any idea?
|
|
|
|
|
Its probably due to the difference between a selection change and no change.
When you click the item for the 1st time, the control sends a message to the windows owner using SendMessage(). This causes the message loop to pump and process all the messages in the queue (otherwise the thread would block) which causes any WM_DRAWITEMs in the queue to be processed. When clicking the item the second time, the selection changing messages are not sent, as there has been no selection change, so the queue is not pumped until it returns from the LButton handler.
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
Hi Roger,
thanks for your reply.
You explanation seems very reasonable.
How would you solve that delay?
I tried to force sending selection change by calling SetSelectionMark method in OnLButtonDown,but the delay stays still.
I even called Update method or RedrawItems but the result is the same.
What cause the sole WM_DRAWITEM event to be sent after LButton handler returns?
How to solve the delay?
|
|
|
|
|
I think you would need to call:
RedrawItems(index, index);
UpdateWindow();
To move up the WM_DRAWITEM calls.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Roger,
the problem still exists.
|
|
|
|
|
i have two IDD forms (MFC) and i want to be able to click a button on one to open up the other i have added the onclick handler but just cant get the code for opening anywhere can anyone help
|
|
|
|
|
|
And if it is a CFormView you need to create a new document, like this.
POSITION templatePos = GetFirstDocTemplatePosition();
while(templatePos != NULL)
{
CDocTemplate* pTemplate = GetNextDocTemplate(templatePos);
CString strDocName;
pTemplate->GetDocString(strDocName, CDocTemplate::docName);
if(strDocName == "Form you want to open")
pTemplate->OpenDocumentFile(NULL);
}
Alfredo
|
|
|
|
|
I've created an ActiveX control using MFC ActiveX control wizard. But, when I add that control to another MFC Dialog Window, I couldnot run the application. When run in the debug mode, i couldn't include the necessary system dll files. Help me.
Shenthil.
|
|
|
|
|
Have the controls been registered?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi all,
I wanna Create a word document,and then create a table with 3 cols and 5 rows,fill the table with some text, and then insert a row at the end of the table, then fill the text"ok" in the new rows.
Could somebody give me a hand and show me some samples related to VC++ operateing the office WORD?
Thanks!
|
|
|
|
|
|
Sorry, if this seems like a stupid question, but I simple cannot figure out how to run macros in VS.Net 2003.
I have pasted some macro functions into the MyMacro module, but when I try to assign a key to the macro only the predefined macros in the Samples module appear in the listbox.
Any help is much appreciated.
|
|
|
|
|
Can u pls help me out with code in VC++.
I have got a bitstream/ compressed form of audio in a file "compresed.bts" by passing the Audio wav file through some graph filters in DirectShow.
Precisely I have used GSM 6.10 Encoder as a filter. Now how do I decode this Bitstream back to the original wav file. Please help !!!
Do I have to use decode filter in the playback graph but I do not know how to get the GSM 6.10 decoder filter.
Pls help....
|
|
|
|
|
hi,
my project is using some third party controls(crystal reports) i need to know what are all the dll depends on the project. any one help to me.
thanks in advance.
|
|
|
|
|
Use the Dependency Checker utility that ships with Visual Studio.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
There is concept of CODEPAGE in VC++. How I can use this feature, if I want to make my application in a language like Greek or Gujarati? I need more help on the CodePage property. How we can use it or define it in our applicaiton?
Gaurang Shah
|
|
|
|
|
Hi everybody!
Do someone know how to compare sequence number for packets I recieve? I will check if there is a packet missing when I recieve mpeg-2 packets.
Thankful for your help,
|
|
|
|
|
I want to access database which is in MY SQL on Linux machine from my "C" prgram without creating DSN. For that i have used function SQLDriverConnect as follows.
#define MAXBUFLEN 255
SQLHENV hEnv = SQL_NULL_HENV;
SQLHDBC hDBC = SQL_NULL_HDBC;
SQLHSTMT hStmt = SQL_NULL_HSTMT;
SQLCHAR ConnStrIn[MAXBUFLEN] =
"DRIVER={MYSQL ODBC 3.51 driver};SERVER=192.168.1.60;"
"UID=mWD=m;DATABASE=ftp;";
SQLCHAR ConnStrOut[MAXBUFLEN];
SQLSMALLINT cbConnStrOut = 0;
RETCODE retcode; // Return code
retcode = SQLDriverConnect(hDBC,// Connection handle
NULL, // Window handle
ConnStrIn, // Input connect string
SQL_NTS, // Null-terminated string
ConnStrOut, // Address of output buffer
MAXBUFLEN, // Size of output buffer
&cbConnStrOut,// Address of output length
SQL_DRIVER_NOPROMPT);
It returns SQL_ERROR.
Can you please suggest me where i am going wrong. I think it is in the "ConnStrIn".
|
|
|
|
|
I have a dialog with some buttons and MFC GridCtrl's. When the focus is on the last cell of the grid and the tab key is pressed, I want to set the focus to the next control. How do you do this?
I have played around with the GetDlgCode() etc. but haven't really been able to get this working.
|
|
|
|
|
Have you tried SetFocus() ????
Best Wishes,
ez_way
|
|
|
|
|
I think I haven't explained myself correctly. What I need to know is where to catch the tab key and set the focus to the next control. Normally (e.g. with buttons etc.) the dialog seems to handle this.
|
|
|
|
|
Hi Brian
Please don't yell for a stupid idea but the tab order you set with CTRL+D shows the tabs,... yes?
Well with that in mind can you not set focus whereever you wish?
I know this is really not a great answer but it worked for me in a tabbed prj.
Best Wishes,
ez_way
|
|
|
|
|
Martin,
thanks for your reply, but that will not work for me as my controls are dynamically created.
|
|
|
|
|
Oh yes, one more thing
when you set the focus please make sure to note the overload function.
SetFocus(GetDlgItem(hDial, ID_VERT_RES));
Best Wishes,
ez_way
|
|
|
|