Click here to Skip to main content
16,005,467 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: BCGControlBar vs. CodeJock XTreme Toolkit Pin
Taka Muraoka19-Sep-03 23:29
Taka Muraoka19-Sep-03 23:29 
GeneralUDP Sample Program Pin
Ilamparithi19-Sep-03 18:54
Ilamparithi19-Sep-03 18:54 
GeneralRe: UDP Sample Program Pin
Rickard Andersson2020-Sep-03 2:15
Rickard Andersson2020-Sep-03 2:15 
GeneralData sending problem in CSocket Pin
Jegan Sasi19-Sep-03 18:50
Jegan Sasi19-Sep-03 18:50 
GeneralRe: Data sending problem in CSocket Pin
Luis Mejia20-Sep-03 10:42
Luis Mejia20-Sep-03 10:42 
GeneralHotkey combinations Pin
ironhead19-Sep-03 17:59
ironhead19-Sep-03 17:59 
GeneralShellExecute Pin
hemanheman19-Sep-03 15:47
hemanheman19-Sep-03 15:47 
GeneralRebar and Toolbars Pin
fgabrieli19-Sep-03 11:30
fgabrieli19-Sep-03 11:30 
Ive been working on a program that creates a window and adds a ReBar with two bands, each one for a different Toolbar.

Im using the following code:

INT SetNewBand(HWND hwndOwner, HWND hwndRB, HWND hTool, RECT *rRC)
{
RECT rc ;
RECT hToolRC ;
RECT hwndRBrc ;
REBARBANDINFO rbBand ;
BOOL FirstToolbar = FALSE ;
RECT hToolRC_new ;

/* Fill rbBand structure */

rbBand.cbSize = sizeof(REBARBANDINFO) ;

rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE |
RBBIM_SIZE;

rbBand.fStyle = RBBS_CHILDEDGE | RBBS_USECHEVRON |
RBBS_VARIABLEHEIGHT | RBBS_GRIPPERALWAYS |
RBBS_BREAK ;

GetWindowRect(hwndRB, &hwndRBrc) ;

/* This is the first toolbar */

if (hwndRBrc.top == hwndRBrc.bottom)
FirstToolbar = TRUE ;

GetWindowRect((HWND) hTool, &hToolRC) ;

rbBand.hwndChild = hTool ;
rbBand.cxMinChild = 0 ;
rbBand.cyMinChild = hToolRC.bottom - hToolRC.top ;
rbBand.cx = 200 ;

if (!SendMessage(hwndRB, RB_INSERTBAND, (WPARAM) -1, (LPARAM) &rbBand))
{
dbgprint(("RB_INSERTBAND failed.\n")) ;
return -1 ;
}

// If this is the first toolbar, we dont need to
// fix any sizes.

if (FirstToolbar == TRUE)
{
GetWindowRect((HWND) hTool, &hToolRC) ;

// Leave a space between the gripper and the first button
SetWindowPos(hTool, NULL, 10, 0, 0, 0, SWP_NOSIZE);

GetWindowRect(hwndRB, &hwndRBrc) ;
memcpy(rRC, &hwndRBrc, sizeof(RECT)) ;
return 0 ;
}

// The Tool Bar will be at the bottom of the rest of
// the present windows.

GetWindowRect((HWND) hTool, &hToolRC) ;

if (SetWindowPos(hTool, NULL, 0, hwndRBrc.bottom-hwndRBrc.top, 0, 0, SWP_NOSIZE) == 0)
return -1 ;

GetWindowRect((HWND) hTool, &hToolRC) ;

// The rectangle will include the new Tool Bar.

GetWindowRect((HWND) hwndRB, &hwndRBrc) ;

rc.left = hwndRBrc.left ;
rc.right = hwndRBrc.right ;
rc.top = hwndRBrc.top ;

rc.bottom = hwndRBrc.bottom + rbBand.cyMinChild ;

SendMessage(hwndRB, RB_SIZETORECT, 0, (LPARAM) (LPRECT) &rc) ;

GetWindowRect(hwndRB, &hwndRBrc) ;
GetWindowRect(hTool, &hToolRC_new) ;

SetWindowPos(hTool, NULL, 10, hToolRC.top - hToolRC_new.top,
0, 0, SWP_NOSIZE) ;

return 0 ;
}

If the toolbar is the first, then i add it without doing a RB_SIZETORECT because it is not needed. Else i do so.

What i saw when working with this is

1) If i send RB_SIZETORECT, the second toolbar changes it position and returns to the values before the SetWindowPos.

2) If i do a SetWindowPos after resizing the rectangle of the ReBar window for the second toolbar, then i see it in a right position.

My questions are:

1) If i want to add n toolbars, i will have to set the sizes for each window ? Is there any message or function in Windows API that arranges all of them automatically ?

2) When i modify manually (with the grip) the position of a Toolbar, the buttons dissapear. I have to handle the messages for the ReBar and Toolbar to set the positions of the bands/toolbars every time the users changes it ?

3) If i have to implement the chevron, i will have to handle all the chevron MSGS and also do the TrackPopupMenu with all my buttons ?

Thank you very much for reading this message.

Bye,
Fernando.

Fernando Gabrieli
GeneralFont dialog problems Pin
halblonious19-Sep-03 11:12
halblonious19-Sep-03 11:12 
Generalperformance question Pin
Gary Kirkham19-Sep-03 10:59
Gary Kirkham19-Sep-03 10:59 
GeneralRe: performance question Pin
Joe Woodbury19-Sep-03 12:35
professionalJoe Woodbury19-Sep-03 12:35 
GeneralRe: performance question Pin
Tim Smith19-Sep-03 12:40
Tim Smith19-Sep-03 12:40 
GeneralRe: performance question Pin
Gary Kirkham19-Sep-03 13:26
Gary Kirkham19-Sep-03 13:26 
GeneralRe: performance question Pin
Gary R. Wheeler20-Sep-03 3:28
Gary R. Wheeler20-Sep-03 3:28 
GeneralRe: performance question Pin
Gary Kirkham20-Sep-03 11:52
Gary Kirkham20-Sep-03 11:52 
GeneralRe: performance question Pin
Gary R. Wheeler20-Sep-03 14:13
Gary R. Wheeler20-Sep-03 14:13 
Generalpassing data structures Pin
Sirrius19-Sep-03 10:36
Sirrius19-Sep-03 10:36 
GeneralRe: passing data structures Pin
Michael Dunn19-Sep-03 11:11
sitebuilderMichael Dunn19-Sep-03 11:11 
GeneralRe: passing data structures Pin
Sirrius19-Sep-03 14:36
Sirrius19-Sep-03 14:36 
GeneralRe: passing data structures Pin
Sirrius19-Sep-03 13:00
Sirrius19-Sep-03 13:00 
GeneralWord wrap in Rich Edit and multiline edit Pin
insanely42019-Sep-03 9:07
insanely42019-Sep-03 9:07 
GeneralRe: Word wrap in Rich Edit and multiline edit Pin
David Pritchard1-Jun-04 14:21
David Pritchard1-Jun-04 14:21 
GeneralFinding the sum of all intergers between x & y Pin
pam128819-Sep-03 9:03
pam128819-Sep-03 9:03 
GeneralRe: Finding the sum of all intergers between x & y Pin
Tim Deveaux19-Sep-03 9:31
Tim Deveaux19-Sep-03 9:31 
GeneralRe: Finding the sum of all intergers between x & y Pin
Tim Smith19-Sep-03 9:34
Tim Smith19-Sep-03 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.