Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - [SOLVED]Snap layout for Win11
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED]Snap layout for Win11

 Post Reply Post Reply
Author
Message
PST View Drop Down
Newbie
Newbie


Joined: 11 January 2022
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote PST Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED]Snap layout for Win11
    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?
Back to Top
agontarenko View Drop Down
Admin Group
Admin Group


Joined: 25 March 2016
Status: Offline
Points: 260
Post Options Post Options   Thanks (0) Thanks(0)   Quote agontarenko Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2024 at 1:57am


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  
Back to Top
PST View Drop Down
Newbie
Newbie


Joined: 11 January 2022
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote PST Quote  Post ReplyReply Direct Link To This Post Posted: 22 February 2024 at 4:50am
Hi Artem, does that mean there is no plan to fix this issue in one of your next releases?
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 29 February 2024 at 12:14pm
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.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 29 February 2024 at 1:18pm
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.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 29 February 2024 at 1:57pm
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.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 29 February 2024 at 2:00pm
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.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 29 February 2024 at 3:09pm
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).
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 01 March 2024 at 2:06pm
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);
}

Back to Top
Pesci7 View Drop Down
Groupie
Groupie
Avatar

Joined: 27 January 2021
Location: Italy
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pesci7 Quote  Post ReplyReply Direct Link To This Post Posted: 04 March 2024 at 9:15am
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++)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.219 seconds.