Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Agemaniac

MFC topmost dialog

This topic is 5221 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, im using MFC and visual C++ 6.0 in my aplication. I need a dialog to be always on top (but when i click the main window it responds normally). how can i do this?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
WS_EX_TOPMOST

Share this post


Link to post
Share on other sites
I considered suggesting that also, but it''s been my experience that it can act rather flaky at times, especially if you don''t explicitly define placement of the other windows in your application. Worth a shot though. It''s a bit more likely to be stable if you use SetWindowPos in the initialization like this:

SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

-fel

Share this post


Link to post
Share on other sites
Humm..many thanks .felisandria, you seen to know a lot about MFC.

But, How can i use a dialog Bar in floating mode?? i already make a program that uses dialog bar but it is always attached to the main window

Share this post


Link to post
Share on other sites
Yep, that can be hard to find because it''s a matter of the CFrameWnd, not the CDialogBar. You need to make the call to

CFrameWnd::FloatControlBar( pointer to control bar, location to put the top left corner of the floating bar, alignment style);

from whoever your CFrameWnd is.

Alternately, if you want to forbid the CDialogBar from ever docking, call

EnableDocking(0);

for the CDialogBar. Keep in mind that if you have multiple bars you might need to call

EnableDocking(CBRS_FLOAT_MULTI);

to allow multiple bars to float for a given CFrameWnd.

Yeah, I used to do basically nothing but MFC programming, these days I do a lot more hardware interface though.

-fel

Share this post


Link to post
Share on other sites
Hum..yes..your solution solve my problem. But, my problem is that: when i use a dialog that is always on top and move it, the main window (an openGl aplication) keep updating, but when i move the dialog bar the main window stop updating. I need the main frame to keep updating when i move the dialog bar. Is it possible? should i overrride the OnMove function and do something?

humm..do u use your icq?

[edited by - Agemaniac on June 3, 2004 2:31:20 PM]

Is there a way to make a button with TBSTYLE_CHECKGROUP or TBSTYLE_CHECK in a dialog like in a tool bar?? I have tried the BS_PUSHLIKE and all others but any have what i want.

[edited by - Agemaniac on June 3, 2004 3:35:11 PM]

Share this post


Link to post
Share on other sites
quote:

Hum..yes..your solution solve my problem. But, my problem is that: when i use a dialog that is always on top and move it, the main window (an openGl aplication) keep updating, but when i move the dialog bar the main window stop updating. I need the main frame to keep updating when i move the dialog bar. Is it possible? should i overrride the OnMove function and do something?


You can override the OnMove probably, and then ask the window you''re concerned about to update.
quote:

humm..do u use your icq?


I have ICQ? Oh, hey, I do have it listed. I don''t think I have it installed on any of my computers though. Sorry.
quote:

Is there a way to make a button with TBSTYLE_CHECKGROUP or TBSTYLE_CHECK in a dialog like in a tool bar?? I have tried the BS_PUSHLIKE and all others but any have what i want.


BS_PUSHLIKE should be the closest. Maybe your problem is that BS_PUSHLIKE only works if you have the button defined as a radio, check, or 3-state check button also? At least I think that''s the case, it''s been a very very long time since I used one of those. Try adding the BS_RADIOBUTTON flag and see if that helps.

-fel

Share this post


Link to post
Share on other sites
hum..it works..but the button appear like a radio button, as expected. But, i wanna a Normal Check Button

"BS_PUSHLIKE only works if you have the button defined as a radio, check, or 3-state check"

is there a style that said that the button have the style "check"? something like BS_CHECK?? i could find anything like this in the MSDN list.

radio and 3-state check works, but dont wanna a radio button, so, both cant be used

sorry about bother u a lot!!


my english is very poor, hope that u can understand all this
^^

Share this post


Link to post
Share on other sites
I'm a little confused here. I was under the impression that you wanted a button that looks like a button but has a "pushed down" state and a "popped up" state. For that, if you use BS_RADIOBUTTON | BS_PUSHLIKE it should, if I remember right, do that. If you want a checkbox, then use BS_CHECKBOX.

Edit:

I tried messing with it, granted I have VC7 and not 6 so your mileage may vary. I couldn't get it to work using SetButtonState, but I could if I opened the .rc (use notepad, it's not as scary as it looks), found my line where my button is defined, and added "BS_AUTOCHECKBOX | BS_PUSHLIKE" in the appropriate area. That will give you a button that looks like a button, but that stays pushed down when you push it, then pops up when you push it again.

For clarity, in VC7 the line looks like this:

PUSHBUTTON "Run",IDC_RUN,137,89,50,14,BS_AUTOCHECKBOX | BS_PUSHLIKE

but I think VC5 had the flags on the other side and a different delimiter like this:
CONTROL "Run",IDC_RUN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE,137,89,50,14

I don't remember what 6 looks like, just add your stuff in where it seems appropriate.

-fel


[edited by - felisandria on June 3, 2004 4:57:46 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!