[SOLVED]Snap layout for Win11 |
Post Reply |
Author | |
PST
Newbie Joined: 11 January 2022 Status: Offline Points: 5 |
Post Options
Thanks(0)
Posted: 26 January 2024 at 7:59am |
Hi, I'm missing Snap layout support for Win11 when using Ribbon control. I can see there is support done for CommandBar (already in 20.3 according to release notes) but there was nothing done for Ribbon control - this was already mentioned in one post quite a while ago.
Or did I overlook something?
|
|
agontarenko
Admin Group Joined: 25 March 2016 Status: Offline Points: 299 |
Post Options
Thanks(0)
|
Hello, As for snap layouts with MDI child - this problem already fixed. As for snap layouts with Main form which contains ribbon - Codejock hide original caption and draw custom caption with custom buttons thus in this case snap layouts will not shown. You can see attached screenshot which demonstrate it is. Regards, Artem Gontarenko |
|
PST
Newbie Joined: 11 January 2022 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Hi Artem, does that mean there is no plan to fix this issue in one of your next releases?
|
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 891 |
Post Options
Thanks(0)
|
I'm not quite understanding this reply. Am I supposed to modify IsCaptionVisible and just return TRUE? I tried that and immediately got an assert in CJ's CXTPModernUIFrameCaptionButton::SetBackgroundColor followed by a crash in CXTPMarkupObject::GetValue(CXTPMarkupDependencyProperty* pProperty).
This happens when I am starting up the app. The m_pMarkupUIElement is nullptr.
|
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 891 |
Post Options
Thanks(0)
|
By the way, you can use Windows+z key in to get the snap menu. That's as close as I got with CJ as we use the ribbon UI.
I do create my own floating frames for our documents and I don't use a ribbon. Snap, rounded corners and the OS provided shadow in Win11 all work just fine.
|
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 891 |
Post Options
Thanks(0)
|
I can avoid the CJ crash if I return TRUE from IsCaptionvisible AND I don't call CXTPRibbonBar::EnableFrameTheme(TRUE). I can also avoid calling DwmSetWindowAttribute to turn on rounded corners in Win11. I also did not turn on CJ shadows. The result is below. Rounded corners, OS provided shadows and (not shown) I get the Snap menu when over the maximize or restor icon. But, I lost the custom caption, of course, and the Quick Access Bar is no longer in the caption area when I show the ribbon. | |
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 891 |
Post Options
Thanks(0)
|
Trying to insert an image since they didn't show up. This time I ran insert image in the edit toolbar and got another error. Try and try again.
|
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 891 |
Post Options
Thanks(0)
|
Well this is promising. I made only one change. I implemented OnNcHitTest. I got the XTPXControl from the ribbon bar for the maximize button and after calling ScreenToClient on the input point, I called GetRect() on the control and then if PtInRect returns true, I return HTMAXBUTTON.
Now I get the snap menu whether I have a document open or not. I don't have to turn off the frame theme nor return TRUE from IsCaptionVisible. Now I have to implement the NC button down since clicking on the caption button doesn't result in maximizing the window (which I expected would happen).
|
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 891 |
Post Options
Thanks(0)
|
Seems to be working just fine. I didn't really need OnLcLButtonUp but I keep it for completeness. I needed the button down to make sure the control executes and tracking is correct while the mouse is down. I needed mouse move to ensure selecting and highlighting worked as it should. Now I have SNAP in all cases I know to try.
LRESULT JCXTPRibbonBar::OnNcHitTest(CPoint point) { CXTPControl* pButton = m_pControls->FindControl(SC_MAXIMIZE); if( nullptr == pButton ) { pButton = m_pControls->FindControl(SC_RESTORE); } if( pButton ) { CPoint ptClient = point; ScreenToClient(&ptClient); CRect rcControl = pButton->GetRect(); if( rcControl.PtInRect(ptClient) ) { return HTMAXBUTTON; } } LRESULT lr = CXTPRibbonBar::OnNcHitTest(point); return lr; } void JCXTPRibbonBar::OnNcLButtonDown(UINT nHitTest, CPoint point) { if( HTMAXBUTTON == nHitTest )// HTMAXBUTTON is 9 { CPoint ptClient = point; ScreenToClient(&ptClient); return OnLButtonDown(1,ptClient); } CXTPCommandBar::OnNcLButtonDown( nHitTest, point); } void JCXTPRibbonBar::OnNcLButtonUp(UINT nHitTest, CPoint point) { if( HTMAXBUTTON == nHitTest )// HTMAXBUTTON is 9 { CPoint ptClient = point; ScreenToClient(&ptClient); return OnLButtonUp(1,ptClient); } CXTPCommandBar::OnNcLButtonUp( nHitTest, point); } void JCXTPRibbonBar::OnNcMouseMove(UINT nHitTest, CPoint point) { if( HTMAXBUTTON == nHitTest )// HTMAXBUTTON is 9 { CPoint ptClient = point; ScreenToClient(&ptClient); return OnMouseMove(0,ptClient); } OnMouseLeave(); CWnd::OnNcMouseMove(nHitTest, point); } |
|
Pesci7
Groupie Joined: 27 January 2021 Location: Italy Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Tested on my side and snap works fine. I hope it will be fixed also in the next release. Speaking of the next release, it's been 11 months without any release...
|
|
Product: Xtreme ToolkitPro (22.1.0)
Platform: Windows 11 (x64) Language: Visual Studio 2022 (C++) |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |