PDA

View Full Version : Add IRollUpPanel to IRollUpWindow on custom window (SDK)


RustyKnight
10-15-2007, 08:58 AM
Hi All!!

I've been bagging my against this problem all day.

Basically, I've created myself a ICUIFrame, onto which (I think) I've attached a IRollupWindow


// Create the custom window...
HWND hToolbar = CreateWindow(
CUSTTOOLBARWINDOWCLASS,
NULL,
WS_CHILD | WS_VISIBLE,
0, 0, 250, 100,
hWnd,
NULL,
hInstance,
NULL);

// -- Now link the toolbar to the CUI frame
ICustToolbar *iToolBar = GetICustToolbar(hToolbar);
iToolBar->LinkToCUIFrame(hWnd, NULL);
iToolBar->SetBottomBorder(FALSE);
iToolBar->SetTopBorder(FALSE);
iToolBar->SetNumRows(2);

// Manages the messages for our toolbar...
tbMsgHandler = new TBMsgHandler(iFrame);
iFrame->InstallMsgHandler(tbMsgHandler);

// Set up the size and position
RECT rect;
SIZE sz;
iToolBar->GetFloatingCUIFrameSize(&sz);

rect.top = 200; rect.left = 200;
rect.right = rect.left+250; rect.bottom = rect.top+100;
GetCUIFrameMgr()->FloatCUIWindow(hWnd, &rect);
MoveWindow(hWnd, rect.left, rect.right, 250, 100, TRUE);

// Dynamically create the rollup window...
IRollupWindow *irup = CreateRollupWindow(_T("ruTest"), 0, 0, 100, 100, iToolBar->GetHwnd(), hInstance);

Thus far, we seem to doing quite well. My problem is now, how do I add a new IRollupPanel to the IRollupWindow?!

Now I know, you've all gone, that's easy...actually, it's not...for me....

virtual int IRollupWindow::AppendRollup ( HINSTANCE hInst,

MCHAR * dlgTemplate,

DLGPROC dlgProc,

MCHAR * title,

LPARAM param = 0,

DWORD flags = 0,

int category = ROLLUP_CAT_STANDARD
) [pure virtual]
The problem I have is I don't have dlgTemplate (parameter 2). This is typically derived from the imbeded resource file, but I don't have one.

I thought of creating one with the rollout window on it, but then how do I make it into a custom toolbar?!

I've spent some time trying to figure out how I can create one, but without any real luck.

Any ideas and help would be appriciated.

scorpion007
10-15-2007, 01:27 PM
A rollup panel is really just a dialog child window, with special behaviours that are managed by its parent, the rollup window.

All you need to do is create a dialog resource and use the MAKEINTRESOURCE() macro to pass it to AppendRollup().

What you have so far is the following:

CUIFrame->CustToolbar->RollupWindow. ( "->" means "contains" ).

A RollupWindow can "contain" zero or more RollupPanels (which are implemented as dialogs).

Does that help?

RustyKnight
10-16-2007, 01:07 AM
Okay, I think I understand. So what I need to do is create a blank dialog "template" and use that as the bases for my calls.

Can I use the same dialog multiple times and will they have seperate hWnds?

Basically, I want to be able to dynamically add buttons to that panel.

Cheers
Shane

ps - Thanks for taking it easy on me, I appricate it ;)

scorpion007
10-16-2007, 02:16 AM
Yeah, that should work.

If you're going to add controls (child windows) dynamically, you can use CreateWindow, specifying the child style, and passing the dialog's HWND as the parent.

The difficult part is managing the dialog's size yourself as you add buttons, etc. But it should be possible.

RustyKnight
10-16-2007, 03:47 AM
The difficult part is managing the dialog's size yourself as you add buttons, etc. But it should be possible.I've done layout work before in Java, so I've got some ideas, but windows always seems to have a surprise for me ;)

Shane

CGTalk Moderation
10-16-2007, 03:47 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.