Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - CommandBar->Width
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CommandBar->Width

 Post Reply Post Reply
Author
Message
Number8 View Drop Down
Groupie
Groupie


Joined: 29 July 2008
Location: United States
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Number8 Quote  Post ReplyReply Direct Link To This Post Topic: CommandBar->Width
    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++

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 03 December 2008 at 4:27am
Pixels.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Number8 View Drop Down
Groupie
Groupie


Joined: 29 July 2008
Location: United States
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Number8 Quote  Post ReplyReply Direct Link To This Post 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++

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Number8 View Drop Down
Groupie
Groupie


Joined: 29 July 2008
Location: United States
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Number8 Quote  Post ReplyReply Direct Link To This Post 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++

Back to Top
Number8 View Drop Down
Groupie
Groupie


Joined: 29 July 2008
Location: United States
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Number8 Quote  Post ReplyReply Direct Link To This Post 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++

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Number8 View Drop Down
Groupie
Groupie


Joined: 29 July 2008
Location: United States
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Number8 Quote  Post ReplyReply Direct Link To This Post 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++

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Number8 View Drop Down
Groupie
Groupie


Joined: 29 July 2008
Location: United States
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Number8 Quote  Post ReplyReply Direct Link To This Post 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++

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
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.233 seconds.