Notifications
Clear all

[Closed] Create dynamic controls in sdk

Hi all!!

I need to create an unknown number of IRollupWindow’s, but my main stumbling block is the need for a control hwnd handle.

I also need to populate these rollups with a number of additional controls…

How does one dynamically create a hwnd value and attach it to a dialog?!

I need to have all this work on ICUIFrame and IToolbar…

All help is greatly appriciated!!

Shane

9 Replies

I’ve no experience with that but I found these posts:

http://discussion.autodesk.com/thread.jspa?threadID=576650
http://discussion.autodesk.com/thread.jspa?threadID=577417

Add a custom control to your dialog using the resource editor and give it the class “RollupWindow”. Then you can add rollups to it like so:

IRollupWindow* iRoll = 0;
iRoll = GetIRollup(GetDlgItem(hDlg, IDC_ROLLUPWINDOW));
iRoll->AppendRollup(hInstance, MAKEINTRESOURCE(IDD_MAX_GENERAL_ROLLUP), (DLGPROC)SGeneralRollupProc, "General", 0, eds.genOpen ? 0 : APPENDROLL_CLOSED);

(quote from the old Sparks website, cannot find the link in the Max SDK discussion group)

Are you sure you need to create an unknown number of IRollupWindows? One IRollupWindow can contain any number of Rollups (created in the form of a dialog with WS_CHILD style) inside it.

To dynamically create a Window, you use CreateWindow(Ex). This function returns a fresh new HWND.

But I think you should be a little more specific on what kind of UI you are trying to create so we can offer better advice.

I appologise for me vaugness, I’m still getting my head around the controls and their relationships.

Basically.

I need a ICUIFrame, which has a IRolloutWindow, which can have n number of IRolloutPanels added to it dynamically.

Each IRolloutPanel can have n number of buttons on them.

The ICUIFrame will also contain a number of buttons that provide additional functionality to the user.

The ICUIFrame needs to be dockable, so it can dock to the side the toolbar areas or float, as the user sees fit.

The code snipet the ypuech has provided seems like a good jumping off point, but it would be interesting to know how to go about building UI elements dynamically so I have the ability to expand this idea should I need to.

Thanks to the both of you!

You can create UI elements dynamically using CreateWindow() or CreateWindowEx() from Windows win32 API as coded in the two forum links I provided.

Thanks ypuech, that’s the confirmation I was looking for…(sorry, I’ve only glanced at the forum links and they both look really good).

To me, createWindow…well, creates a window… …I had a feeling that every control was indeed a type of window, but I wasn’t sure. I’ve not coded directly under the windows api before.

Thanks for that

Shane

I have a solution (of sorts…)! Thank you very much for you patience! I really appriciate the support you all provide and it makes life a hell of a lot eaiser having you guys/gals to bounce ideas and ask advice off.

Thank you
Shane

If you’ve never coded with the win32 API, there’s a useful tutorial at http://www.functionx.com/win32/index.htm

2 Replies
(@rustyknight)
Joined: 11 months ago

Posts: 0

That is going to be a massive help! Cheers

Shane

(@ypuech)
Joined: 11 months ago

Posts: 0

Yes, and if you go to http://www.functionx.com/ you can see that there’s plenty of others resources about C++, MFC, C#, .Net etc.
The .Net tutorials contain some useful tutorials on .Net froms controls (ListView, TreeView, etc.).