|
I'm new here, please bear with me.
I'm not sure if this is the appropriate place to put it, as my question is regarding C++, but for OWL rather than MFC. Anyways, down to the problem:
I'm maintaining some legacy code which involves a multi-line listbox. The contents of this listbox are loaded in through the EvDrawItem function. The EvDrawItem gets called repeatedly. While selecting an object, the cells in the listbox are selected one at a time too, and we are manually painting it in (not sure if this is the right way to do it). This becomes noticeable only when the items are long.
Now, here's the biggest part of the problem: when double-clicking on an item, we are supposed to pop up an edit box. While this does happen, the double-clicking is seen to cause the item to do cycles of "select, select, de-select, select"...about 50 (each cycle is made up of 4 EvDrawItems) times (is this normal???).
With some research, I do feel that I should probably make use of the setredraw and invalidate functions, but I'm not sure where's the best place to put these codes in so that they propagate through the rest of the program where similar listboxes are used.
Also, since the draw and the insertions are handled together, would suppressing redraw affect how the list loads up?
modified on Friday, January 29, 2010 2:45 PM
|
|
|
|
|
Look at the documentation for the WM_SETREDRAW message. It's used to disable/enable redrawing of listboxes.
L u n a t i c F r i n g e
|
|
|
|
|
Hi,
Thank you for your response. Yes, I've already looked at that, and I do feel it would help, just trying to find the best place to put it. However, I'm still not sure why it does the "select, select, deselect, select" thing so many times on a double-click. I would suspect it's not a normal behaviour even without disabling the redraw.
Thanks!
|
|
|
|
|
Rock Bottom wrote: However, I'm still not sure why it does the "select, select, deselect, select" thing so many times on a double-click
Yeah, I'm clueless on that one. Sorry.
L u n a t i c F r i n g e
|
|
|
|
|
Thanks anyways for your response. Hope some more people will chime in. 
|
|
|
|
|
Rock Bottom wrote: ...the double-clicking is seen to cause the item to do cycles of "select, select, de-select, select"...about 50 (each cycle is made up of 4 EvDrawItems) times (is this normal???).
I would expect this behavior with a list control but not a listbox.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Upon further investigation, it turns out that the child control is receiving messages asking it to traverse through all the lines in the selected item. For each of the lines, it receives the following itemAction and itemState (in this order):
1. ODA_SELECT with ODS_SELECTED
2. ODA_FOCUS with ODS_DEFAULT | ODS_SELECTED
3. ODA_FOCUS with ODS_SELECTED
4. ODA_SELECT with 0
Unfortunately, events 1 and 4 cause the program to select/deselect all the rows in the multi-row item, which results in huge flickering. Fortunately, our redraw function does nothing on events 2 and 3 . So right now, my question is:
1. Is this traversing of all the items something that was implemented in the TListBox base class or are we telling it to do that somewhere in our code?
2. Also, is it better to override this traversing to do one big redraw or to override the handling to only select, deselect, then re-select each row?
|
|
|
|
|
Why its too slow to use vfw's preview?When to capture a AVI file ,it's even stock,why?I only did nothing,the dialog become to slow to slip on the desktop.How to solve the problem?Thx!
I am not a genius, but shed more sweat!
|
|
|
|
|
Aric Green wrote: Why its too slow to use vfw's preview?When to capture a AVI file ,it's even stock,why?I only did nothing,the dialog become to slow to slip on the desktop.How to solve the problem?Thx!
Your question is not very clear, can you rephrase it please?
MVP 2010 - are they mad?
|
|
|
|
|
Thx!
I want to use vfw to capture datas and send to another computer,but I found when vfw previewing the computer getting slow.
I am not a genius, but shed more sweat!
|
|
|
|
|
Aric Green wrote: I want to use vfw to capture datas
What is vfw?
Aric Green wrote: but I found when vfw previewing the computer getting slow.
What has this to do with sending information to another computer?
I am afraid your question is still very difficult to understand. Perhaps you could find a colleague or friend who could translate into English on your behalf.
MVP 2010 - are they mad?
|
|
|
|
|
VFW(Video for Windows) provides functions that enable an application to process video data.
hWndC = capCreateCaptureWindow (
(LPSTR) "My Capture Window",
WS_CHILD | WS_VISIBLE,
0, 0, 160, 120,
(HWND) hwndParent,
(int) nID );
Thank you anyway!
I am not a genius, but shed more sweat!
modified on Saturday, January 30, 2010 12:45 AM
|
|
|
|
|
Aric Green wrote: the dialog become to slow to slip on the desktop.
I doubt anyone is going to understand this. I've no idea what you mean by the dialog 'slipping' on the desktop. Do you want the dialog removed or deleted from the desktop?
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
I mean that when it previewing,go to drag the dialog,it will not smoothing.Another mean,the computer getting slowly
I am not a genius, but shed more sweat!
|
|
|
|
|
I havent used capPreview before so cannot comment on that. You try OpenCV[^], it has functions for captuing video and last time I checked they were using vfw under windows.
There are also a number of articles here on capturing video using direct show and vfw.
-Saurabh
|
|
|
|
|
Thank you!
I am not a genius, but shed more sweat!
|
|
|
|
|
Hi
Is there a way of setting the height of vertical scroll bar in a
Combo box? i.e, dropdown height?
i.e., even if there's only one item in the Combo, is
it possible to set the height of vertical scroll bar?
What i have seen is, if there's only one item, the vertical scroll bar
is very small or not at all scrolable. I would like to set it a little
longer so that its scrollable.
Thanks
|
|
|
|
|
dipuks wrote: What i have seen is, if there's only one item, the vertical scroll bar
is very small or not at all scrolable. I would like to set it a little
longer so that its scrollable.
What's the point in enabling the scroll if there's only one item?
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Your question is not really clear because if there is only one item in the dropdown area, the vertical scrollbar is not displayed. You probably mean that you have several items available in the dropdown but only one is visible at a time ? And you would like to increase that so that multiple items are visible at the same time right ?
Well, you can correct that through the resource editor: when you select the combo box, click on the part where the arrow is situated, this will let you adjust the height of the dropdown area, and not the size of the control itself.
|
|
|
|
|
Cedric,
If there are multiple items, it does show a longer vertical scroll bar and thats not the problem.
The problem is when there's only 1 item. At that time, the default Windows thing sets the vertical scroll bar height to a set length so that the one item is visible.
And this works perfect, and the user can always use the mouse pointer to select.
But the issue that am facing is, the application am using will take input from a touch screen. So when using touch screen the smaller vertical scroll bar is an issue.
Hope you undertand the issue.
Thats the reason why i need a longer vertical scroll bar.
Any ideas?
|
|
|
|
|
Well, if there is only one item in your combo box, there's no scrollbar. Why would you need a scrollbar, there's nothing to scroll.
Did you understand my reply at least ? Is that what you were looking for of not ? Did you try it ?
|
|
|
|
|
Ok i read your last reply.
Ok so here's the trick......
the combo box will have technically 2 items, of which the 1st will be a empty item and then a string item.
The reason why the 1st one is an empty item is, because thats the default one. So by default the application will not have any selection in the combo unless user makes a selection.
So basically there are 2 items and the vertical scroll bar as of now is very very small and its difficult to do a touch screen scroll, even though it works fine with mouse.
|
|
|
|
|
Well, did you try what I suggested ? Increasing the size of the dropdown area ?
By default only one item is visible at a time but you have to increase the height of the dropdown area in order to make multiple elements visible (which will of course also increase the height of the scrollbar if any).
You really should try the suggestions that are given to you before replying...
|
|
|
|
|
Once there are 2 defines ONE and TWO available I'd like to test defenition of the both of them to compile the code.
The below presented code does not allow to include the code between #if and #endif lines.
#define ONE
#define TWO
#if defined ONE && TWO
#endif
Чесноков
|
|
|
|
|
there are at least two ways to get it:
#if defined(ONE)
#if defined(TWO)
...
#endif
#endif
#if defined(ONE) && defined(TWO)
...
#endif
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|