Print Page | Close Window

Ribbon Control alignment

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=18101
Printed Date: 01 December 2024 at 7:24am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Ribbon Control alignment
Posted By: mgampi
Subject: Ribbon Control alignment
Date Posted: 22 March 2011 at 10:30am
Hi;

What I got is this:



But I want this:



How?


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



Replies:
Posted By: cpede
Date Posted: 22 March 2011 at 10:36am
I accomplished this by using a xtpControlLabel as the first control, instead of using the label on the xtpControlEdit, or whatever control you are using.
 
-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: mgampi
Date Posted: 22 March 2011 at 10:40am
Hi;

I do this allready! First I load the toolbar ressource, then I create two xtpControlLabel controls:

    pGroup=TabReports->AddGroup(ID_GROUP_REPORT_DATETIME);
    CXTPControl* pControl = pGroup->Add(xtpControlLabel, ID_REPORT_DATE_FROM_CAPTION, 0, 0);
    pControl->SetID(0);
    pControl->SetStyle(xtpButtonCaption);

    pControl = pGroup->Add(xtpControlLabel, ID_REPORT_DATE_TO_CAPTION, 0, 2);
    pControl->SetID(0);
    pControl->SetStyle(xtpButtonCaption);


In OnCreateControl I create my two custom controls to enter timestamps:

    // Create the timestamp control
    if (lpCreateControl->nID == ID_REPORT_DATETIME_FROM)
    {
        FromTime_.AllowEmptyTimestamp(true);
        FromTime_.SetShowSeconds(false);
        FromTime_.SetButtonGap(0);
        if (!FromTime_.Create(0, WS_TABSTOP | WS_CHILD | TSCS_HASCALENDARBUTTON | TSCS_AUTOSIZE,
                              CRect(0,0,160,22), this, ID_REPORT_DATETIME_FROM ))
            return FALSE;

        CSize size(FromTime_.GetBestFit());
        FromTime_.SetWindowPos(0, 0, 0, size.cx, size.cy, SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
        FromTime_.ClearSelection();

        CXTPControlCustom* pControl = CXTPControlCustom::CreateControlCustom(&FromTime_);
        pControl->SetBorders(0, 3, 0, 3);
        // Set the xtpFlagManualUpdate flag.
        // Without this flag you must call the Enable member of
        // CCmdUI in the ON_UPDATE_COMMAND_UI handler.
        pControl->SetFlags(xtpFlagManualUpdate);

        lpCreateControl->pControl = pControl;
        return TRUE;
    }




-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: cpede
Date Posted: 22 March 2011 at 10:55am
Why do you create two captions? And move the second caption after the second index?
 
I would just create one label, and the the two custom controls.
 
-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: mgampi
Date Posted: 22 March 2011 at 11:05am
Hi;

Just after posting my initial question I had to change the layout due to customers wishes I recognized later. The new layout should be this:



Any ideas how to achieve this kind of layout?



-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net