Print Page | Close Window

CommandBar->Width

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=12840
Printed Date: 15 June 2024 at 9:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CommandBar->Width
Posted By: Number8
Subject: CommandBar->Width
Date Posted: 02 December 2008 at 5:48pm
From the SymbolReference.chm:

Width Property
Description
Gets / Sets the width of the toolbar when it is floating, displayed as a popup, or a mini toolbar.

Syntax (Visual Basic)
Public Property Width() As Long


What is the unit the width is measured with? Pixels? Number of buttons? Furlongs?


-------------
Product: Xtreme SuitePro (ActiveX) version 12.1.0
Platform: Windows XP (32bit) - SP 3
Language: C / C++




Replies:
Posted By: Oleg
Date Posted: 03 December 2008 at 4:27am
Pixels.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Number8
Date Posted: 03 December 2008 at 9:24am
I am trying to set the width of a floating toolbar using "buttons" as the unit, as in "I would like my toolbar to be 3 buttons wide".


pControl = pControls->Add(xtpControlButton, nAction, "");
cntrlWidth = pControl->GetWidth();


cntrlWidth == 0.
How can I determine how wide, in pixels, a "3 button wide" toolbar is?



-------------
Product: Xtreme SuitePro (ActiveX) version 12.1.0
Platform: Windows XP (32bit) - SP 3
Language: C / C++



Posted By: Oleg
Date Posted: 03 December 2008 at 11:54am

Hi,

It doesn't look like ActiveX code :)
 
GetWidth return "user" width. You nede call GetSize to get actual width or just use Width = (22 * 3 + border_width)


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Number8
Date Posted: 03 December 2008 at 12:27pm
Thanks for the reply.

Just to clarify, did you mean use the GetRect() method? There is no Size property on the CommandBarControl object...

Nope, that's not the happenin' thing, either:
pControl = pControls->Add(xtpControlButton, nAction, "");
pControl->GetRect(&left, &top, &right, &bottom);

left, top, right, bottom all equal 0.

-------------
Product: Xtreme SuitePro (ActiveX) version 12.1.0
Platform: Windows XP (32bit) - SP 3
Language: C / C++



Posted By: Number8
Date Posted: 03 December 2008 at 1:17pm
Quote Width = (22 * 3 + border_width)

Will '22' change, depending on whether large or small icons are used?
Where does border_width come from?

     HWND hwnd = (HWND) pToolbar->GethWnd();
     wi.cbSize = sizeof(WINDOWINFO);
     GetWindowInfo(hwnd, &wi);

Surprisingly, all the size fields, such as cxWindowBorders, are 0...

(I confirmed with Spy++ that the hwnd variable is indeed the toolbar's HWND.)

-------------
Product: Xtreme SuitePro (ActiveX) version 12.1.0
Platform: Windows XP (32bit) - SP 3
Language: C / C++



Posted By: Oleg
Date Posted: 04 December 2008 at 7:24am
Hi,
yes, it will be depend. Just make screenshot and calculate it :)


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Number8
Date Posted: 04 December 2008 at 8:11am

Any idea why pControl->GetRect(&a, &b, &c, &d) fills all params with 0?

"make screenshot and calculate" is hard to do at runtime...


-------------
Product: Xtreme SuitePro (ActiveX) version 12.1.0
Platform: Windows XP (32bit) - SP 3
Language: C / C++



Posted By: Oleg
Date Posted: 04 December 2008 at 10:11am
I mean this border has always same length. So just check this value.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Number8
Date Posted: 04 December 2008 at 12:47pm
From the WTL Sample shipped with v12.1.0:

m_spCommandBars->LoadDesignerBars(_variant_t((long)IDR_COMMANDBARS), _variant_t((long)_Module.m_hInstResource));

m_spCommandBars->LoadCommandBars(_bstr_t("Codejock Software ActiveX Demos"), _bstr_t("WTLSample"), _bstr_t("Layout"));

m_spCommandBars->ScaleMode = XtremeCommandBars::xtpScalePixel;
// My additions to test GetRect().
ICommandBar * pBar;
long cnt;
pBar = m_spCommandBars->GetItem(2);


ICommandBarControl * pControl;
ICommandBarControls * pControls = pBar->GetControls();
cnt = pControls->GetCount();

long t, l, b, r;
for (int j = 1; j <= cnt; ++j) {
     pControl = pControls->GetItem(j);
     pControl->GetRect(&l, &t, &r, &b);
       // l = 10, t = 2, r = 32, b = 24
     // l & r increment by 22, as expected

}
pControl = pControls->Add(xtpControlButton, 101, "Hi");
if (0 != pControl) {
     pControl->GetRect(&l, &t, &r, &b);
}
// l = t = r = b = 0

pControl = pControls->Find(xtpControlButton, 101);
if (0 != pControl) {
     pControl->GetRect(&l, &t, &r, &b);
}
// l = t = r = b = 0

Frustrating.

-------------
Product: Xtreme SuitePro (ActiveX) version 12.1.0
Platform: Windows XP (32bit) - SP 3
Language: C / C++



Posted By: Oleg
Date Posted: 05 December 2008 at 2:34am
Hi,
 
After you add button Add
m_spCommandBars->RecalcLayout();
to allow commandbars reclculate positions of new controls.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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