I'm trying to create a rebar but everything I put in it get's stretched to 100% of the rebar width, it's very weird and I can't see the problem.
I've already searched and gone over info at msdn relating to my problem and I turned up nothing that worked.
I'm using the following code to make rebars and bands:
HWND CreateReBar(HWND parent)
rebar = CreateWindowEx(WS_EX_TOPMOST|WS_EX_TOOLWINDOW|WS_EX_LEFT|WS_EX_LTRREADING|WS_EX_RIGHTSCROLLBAR,
barInfo.cbSize = sizeof(REBARINFO);
barInfo.fMask = 0;
barInfo.himl = (HIMAGELIST)NULL;
void CreateBand(HWND rebar,char *bandText,HWND child)
bandInfo.cbSize = sizeof(REBARBANDINFO);
bandInfo.fMask = RBBIM_COLORS|RBBIM_TEXT|RBBIM_STYLE|RBBIM_CHILD|
bandInfo.fStyle = RBBS_CHILDEDGE|RBBS_GRIPPERALWAYS;
bandInfo.clrFore = RGB(0,0,0);
bandInfo.clrBack = GetSysColor(COLOR_BTNFACE);
bandInfo.lpText = bandText;
bandInfo.cch = lstrlen(bandInfo.lpText);
bandInfo.hwndChild = child;
bandInfo.cxMinChild = 20;
bandInfo.cyMinChild = rc.bottom - rc.top;
bandInfo.cx = 50;
You're not setting barInfo...
Don't know if it will fix your problems.
if (!SendMessage(rebar, RB_SETBARINFO, 0, (LPARAM)&barInfo))
Take a look at the example at the bottom of this page (if you haven't already).
Yup, I've looked at that page before.. Also adding that message didn't seem to solve the problem at all.
This is most confusing. :confused:
I use these styles
S_VISIBLE | WS_BORDER | WS_CHILD | WS_CLIPCHILDREN |WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NOPARENTALIGN| RBBS_FIXEDSIZE
You also don't set the tollbars ID when adding the band.
A child window must have the HMENU para cast to a unique int resource ID. You have set it to 0 or NULL.
#define IDD_TOOLBAR 40001
I've tried using those styles, and I am assigning an ID thing to the child windows but I'm still getting the same result.
I've attached an image of what's happening.. As you can see the static with the text "test" is being stretched right to the edge of the rebar.. It does the same thing to any other child window I put in the band as well. .
try setting the band.cy
or at least zeroing the structure before you use it
Ok, well I know why it does work... And I have no real reason to want it to work, I was just messing with the rebar control..
However I do have a new problem now.
I'm trying to make it so I can have a vertical rebar if I specify the width but I can't get it to span to that width ... I've tried heaps of different things but nothing seems to work properly.
(w>0?(WS_VISIBLE | WS_BORDER | WS_CHILD | WS_CLIPCHILDREN |WS_CLIPSIBLINGS | CCS_NODIVIDER | RBBS_FIXEDSIZE|CCS_VERT):(WS_VISIBLE | RBS_VARHEIGHT| WS_BORDER | WS_CHILD | WS_CLIPCHILDREN |WS_CLIPSIBLINGS | CCS_NODIVIDER | RBBS_FIXEDSIZE)),