|
thelvaci wrote: if a combo box shows dropdown list and user hits the Cancel button Dialog does not close immediately. It closes the Dropdown list ignoring the cancel button.
User has to push cancel button one more time to close the Dlg.
How can I make it close the dialog immediately?
Yeah it happens. I guess it's so because when the combo list box comes up it captures the mouse(Using SetCapture ).
And now events that occur related to mouse will be relayed to the list box.
This is done so that the list box can be properly closed if the user clicks anywhere outside the list box. Now when the listbox closes it calls ReleaseCapture .
This is the reason why the cancel button doesn't get the mouse event when the list box is visible. But second time it does get.
Nibu thomas
Software Developer
|
|
|
|
|
Thanx for the reply.
I can give you an example: MS Word program File->Open->
In the File Open Dialog box you hit the combobox on top to open the directory tree. Dropdown list opens. Now when one hits the cancel button the drop down list closes immediately and this closes the file dialog.
How is this done?
Rgds
Tahir Helvaci
|
|
|
|
|
I wouldn't recommend trying to do this. It will make your application behave differently to every other Windows application in existance. Combo boxes work this way by design.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanx for the reply.
I can give you an example: MS Word program File->Open->
In the File Open Dialog box you hit the combobox on top to open the directory tree. Dropdown list opens. Now when one hits the cancel button the drop down list closes immediately and this closes the file dialog.
How is this done?
Rgds
Tahir Helvaci
Thelvaci
|
|
|
|
|
Yes, I'd forgotten about MS Office. So Office and your program would be the only ones like it in the world. Almost all applications use the standard Windows File open common dialog box, which does not do this.
Personally, I still think it's a bad idea. I'm not sure what the best way to do it would be. There would be a few complications in getting it right.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
How about the challenge?
thelvaci
|
|
|
|
|
Hello thelvaci
To close dialog immediatly, in the function associated with Cancel, write the following line.
CDialog::OnOK();
I hope this works.
Good luck.
We Believe in Excellence
|
|
|
|
|
Aqueel wrote: in the function associated with Cancel, write the following line.
CDialog::OnOK();
You should not call CDialog::OnOK() from OnCancel() but in fact you should call CDialog::OnCancel() .
Nibu thomas
Software Developer
|
|
|
|
|
actually, OnOK() and OnCancel() bothe call EndDialog() with either IDOK or IDCANCEL as parameter for the returning value of the dialog.
the difference comes because only OnOK performs an UpdateData(TRUE) , so updates the data members of the dialog when the ok button is clicked.
you can so directly call yourself EndDialog(IDCANCEL) , it will work perfectly.
however, this is not exactly what the question was about ...
|
|
|
|
|
Right thing in the wrong place.
Nibu thomas
Software Developer
|
|
|
|
|
Nibu thomas wrote: in the wrong place.
how that ?
i answered to you because i wanted to continue the discussion you started with Aqueel...
|
|
|
|
|
v2.0 wrote: how that ?
i answered to you because i wanted to continue the discussion you started with Aqueel...
You misunderstood.
What I meant was CDialog::OnOk was called at the wrong place.
Nibu thomas
Software Developer
|
|
|
|
|
CDialog::OnCancel() closes the dialog.
The problem in the first place is to have the combobox drop down list to close at the same click of cancel button as in MS Word open filoe dialog and opening the drop down list, when one click on the cancel button it closes the whole file dialog, it does not close just the combobox dropdown list.
It seems that this is a challenge for all the MFC programmers...
thelvaci
|
|
|
|
|
Greetings:
Can anybody offer some advice on how I can dynamically change the bitmap on a toolbar button? I would like a toolbar button that has a bitmap that means "Open" (refering to a USB port). When the user clicks this and the port is successfully opened, I want the bitmap on the button to change to one that means "Close" - and vice-versa of course. This is just one example, there are many places in my application where I might want to do something like this.
I was hoping that it would be something I could do from within the "ON UPDATE UI" procedure associated with the button but its not looking good. So I am unsure how to proceed...
Thanks in advance to anyone who responds.
Mark
|
|
|
|
|
CImageList *img;
m_wndToolBar.GetToolBarCtrl().SetImageList(img);
|
|
|
|
|
Hi, thanks for your response.
When I set the image list, does this refer to just the image for one button? My understanding is that the toolbar gets its button images from a single BMP image "strip". If this is the case, then it looks like I would have to repeat the image "strip" for each button that has two image states.
If I had a tool bar that had only one button that behaved in the way that I described, then I would need only two image strips. However, if TWO buttons on my toolbar toggled between two images, then I would need FOUR image strips to cover every possible permutation. If there were 3, then EIGHT! And so on...
Have I understood this?
Thank you,
Mark
-- modified at 15:16 Wednesday 8th March, 2006
|
|
|
|
|
Read this article:
http://www.codeguru.com/cpp/controls/toolbar/miscellaneous/article.php/c2521/
Create 3 different toolbars one with live colors, second dimmed colors, third with hot mode (when mouse moves over it)
Using OnUpdateUI code your can display buttons of the toolbars
Some graphical and icon software you need to prepare the toolbar
I hope this helps you sort it out.
THelvaci
|
|
|
|
|
Hi, thanks for your response.
I'm not sure that this is exactly what I'm looking for. It has been my experience that if I provide ONE toolbar BMP, then Windows magically provides "dimming services" for each button when that button is disabled. I've never had a problem with that. Furthermore, I'm not really looking for the button to change its appearance when the mouse cursor passes over it. It is enough for my purposes to have the little "tool tip" message pop up when the mouse passes over.
What I do want is for at least one button on the tool bar to completely change the bit map it is using depending on some internal state of the program. For example, when my USB connection to some device is inactive, I want the button to display a BMP that shows a picture of a plug being inserted into a socket. THis means that it will attempt to open the port and connect to the device when the button is clicked. When the user clicks that and the port successfully opens, I want the button to change function. I want it to show a picture of a plug being pulled OUT of a socket and the user will click that to disconnect from the USB port.
I have worked with applications that do this, so I know it can be done.
If you have any other advice, I would appreciate it.
Thank you,
Mark
|
|
|
|
|
Did you ever find a solution for this? I have 8 buttons that I want to do this with. Managing 256 toolbars would be horrendaous.
|
|
|
|
|
Hi!
I'm a prety beginner with Visual Studio 2005 Standard Edition.
I have converted vs 2003 project, in C++, into VS 2005,
But, I can't find EXE file in either debug or release.
When I code new project VS 2005, it automatically generate EXE.
But, converted one doesn't give me EXE file.
I checked Project/configuration manager release, win32.
I don't use any MFC or DLL, I just use pure C++ with OpenGL.
Anybody can help me?
Yonggoo
|
|
|
|
|
click on the "build project" menu item...
|
|
|
|
|
What's "build project" menu item?
I don't have any.
Under "Build" menu,
I have "projcet only"
build only ???
rebulid only ???
clean link only ???
Yonggoo
|
|
|
|
|
did you open the solution ?!
|
|
|
|
|
do you have the right project/solution selected ?
maybe there are some new compiler/linker errors that 2005 detects and stops the compilation ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I got it!
It's set up to send EXE files to a different directory.
Thanks!
Yonggoo
|
|
|
|