DialogBar problem
-
I have a class derived from CDialogBar. I create it in CMainFrm::OnCreate()function. Used- EnableDocking(0) and FloatControlBar(), ShowControlBar() fuinctions to show, set poesition and set size of DialogBar. Now it works well. But in one condition (Say by clicking on some Menu) I dont want Dialogbar to be moved elsewhere. Meaning positions for Dialogbar should get locked. . Again by clicking on same menu it should be moved anywhere. This is the requirement. Now I tryed everything for making it FIXED at one place with OnMOve() for dialogBar. With SetWindowpos() function. For SetWindowPos() I tryed last flag parameter to be NORESIZE but it didnt worked. To confirm that this function works I tryed SWP_HIDEWINDOW then it hides the window. Is there any way that I can toggle between FIXED position mode and Moving mode for Dialogbar??? Parametrs passed to create of Dialogbar CBRS_BOTTOM | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, Is there any message I can get in MainFrame when I am resizing the DialogBar...
AmolM
-
I have a class derived from CDialogBar. I create it in CMainFrm::OnCreate()function. Used- EnableDocking(0) and FloatControlBar(), ShowControlBar() fuinctions to show, set poesition and set size of DialogBar. Now it works well. But in one condition (Say by clicking on some Menu) I dont want Dialogbar to be moved elsewhere. Meaning positions for Dialogbar should get locked. . Again by clicking on same menu it should be moved anywhere. This is the requirement. Now I tryed everything for making it FIXED at one place with OnMOve() for dialogBar. With SetWindowpos() function. For SetWindowPos() I tryed last flag parameter to be NORESIZE but it didnt worked. To confirm that this function works I tryed SWP_HIDEWINDOW then it hides the window. Is there any way that I can toggle between FIXED position mode and Moving mode for Dialogbar??? Parametrs passed to create of Dialogbar CBRS_BOTTOM | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, Is there any message I can get in MainFrame when I am resizing the DialogBar...
AmolM
Did you try to modify the window style? If this does not work, AFAIK, you should override your CDialogClass and block the resizing from within, that is to forbid to resize it with the mouse if a boolean set by your menu item is true.
Aamol M wrote:
SetWindowPos() I tryed last flag parameter to be NORESIZE but it didnt worked.
The SWP_NOSIZE flag is used to specify that the SetWindowPos function arguments relative to resizing won't be used.
Jouir et faire jouir sans faire de mal ni à toi ni à personne, voilà je crois le fondement de toute morale Fold with us! ¤ flickr
-
Did you try to modify the window style? If this does not work, AFAIK, you should override your CDialogClass and block the resizing from within, that is to forbid to resize it with the mouse if a boolean set by your menu item is true.
Aamol M wrote:
SetWindowPos() I tryed last flag parameter to be NORESIZE but it didnt worked.
The SWP_NOSIZE flag is used to specify that the SetWindowPos function arguments relative to resizing won't be used.
Jouir et faire jouir sans faire de mal ni à toi ni à personne, voilà je crois le fondement de toute morale Fold with us! ¤ flickr
ModifyStyle() will work if I remove the caption Bar of it BUT it does not look good. AND requirement is just to make it locked without removing caption abr. Sorry. I have used SWP_NOMOVE flag for not moving the DialogBar... My problem is I want to LOCK the positions in one case and unlock the positions (user can move it anywhere in other case. But what should I override in my class??? I handled OnMove(), OnSize() every other meaage in DialogBar class but it doesnt come there at any time. Is there anything I get notified in CMainFrm OR myDialogBar class that dialogBar is about to move.... I also handled WM_CAPUTRECHANGED message in DialogBar class. Control comes here when I release the capture from that dialogBar. But even at this time I call FloatControlBar() to some fixed position then also it doesnt work. I have read somewhwre that DialogBar notification are sent to the parent window. In this case CMainFrm. But I didnt get it. In CalcDynamicSize() handler of Dialogbar class, control comes here when we even click on caption bar of it. But there also I cant do anything to set the positions to default. I have uesed FloatControlBar() here.
AmolM
-
ModifyStyle() will work if I remove the caption Bar of it BUT it does not look good. AND requirement is just to make it locked without removing caption abr. Sorry. I have used SWP_NOMOVE flag for not moving the DialogBar... My problem is I want to LOCK the positions in one case and unlock the positions (user can move it anywhere in other case. But what should I override in my class??? I handled OnMove(), OnSize() every other meaage in DialogBar class but it doesnt come there at any time. Is there anything I get notified in CMainFrm OR myDialogBar class that dialogBar is about to move.... I also handled WM_CAPUTRECHANGED message in DialogBar class. Control comes here when I release the capture from that dialogBar. But even at this time I call FloatControlBar() to some fixed position then also it doesnt work. I have read somewhwre that DialogBar notification are sent to the parent window. In this case CMainFrm. But I didnt get it. In CalcDynamicSize() handler of Dialogbar class, control comes here when we even click on caption bar of it. But there also I cant do anything to set the positions to default. I have uesed FloatControlBar() here.
AmolM
Aamol M wrote:
I handled OnMove(), OnSize() every other meaage in DialogBar
I wouldn't try that way, because the dialog bar should resize itself when the application resizes, whatever the user-defined lock (or you will face ugly display problems, for instance when your dialog bar docked in the application will be higher than its container). I would rather try to prevent the user to resize by blocking its actions means, that is the mouse and the maximize/minimize buttons if any. So I would rather work on mouse and button messages I won't be able to be more precise, I don't work with CDialogBar but generally with CControlBar derived classes. HTH anyway,
When they kick at your front door How you gonna come? With your hands on your head Or on the trigger of your gun?
-
Aamol M wrote:
I handled OnMove(), OnSize() every other meaage in DialogBar
I wouldn't try that way, because the dialog bar should resize itself when the application resizes, whatever the user-defined lock (or you will face ugly display problems, for instance when your dialog bar docked in the application will be higher than its container). I would rather try to prevent the user to resize by blocking its actions means, that is the mouse and the maximize/minimize buttons if any. So I would rather work on mouse and button messages I won't be able to be more precise, I don't work with CDialogBar but generally with CControlBar derived classes. HTH anyway,
When they kick at your front door How you gonna come? With your hands on your head Or on the trigger of your gun?
Yes. You are right.... Here it is nothing to do with resizing the dialogbar. Its perfectly acceptable that the controls and dialogbar remains as is regardless of application size. I have only 3 bitmaps to show on dialogbar. I hv handled OnLButtonClick for DialogBar by not calling default LButton event and now I can only handle moving of it (blocking of MOVE)from DialogBar. But when I click on CaptionBar of dialogBar then event doesnt come for LButtonDown() in DialogBar class. So if I can know "When I click on CaptionBar of DialogBar then where shd I get message (in MainFrame - parent of that window) or somewhere else. If that only I can figure out, then in that case I will not call default OnLButtonDown() and things shd work for me.... But I cant find where the event comes when I click on CaptionBar() of DialogBar...... Thanks :)
AmolM