Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

Scale custom guis in Dialog groups.

 Post Reply Post Reply
Author
Message
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 309
Post Options Post Options   Quote peterakos Quote  Post ReplyReply Direct Link To This Post Topic: Scale custom guis in Dialog groups.
    Posted: 2017 Oct 09 at 3:42am

User Information:

Cinema 4D Version:   R17 
Platform:   Windows  ;   
Language(s):     C++  ;   

---------

Hello.

I have some problems with the dialog flags in resource file. No matter what I try, I cannot achieve what I want. 
I need to create a content browser-like dialog. To do that, I need a tab group with tree views on the left of the dialog to navigate the contet and a Custom GUI on the right in which I will display the selected content data. I have defined the structure of the dialog in a Resource file. There are some components though that I add dynamically.

Here is the dialog resource. It has 2 tabs.

DIALOG BROWSER_DIALOG {
NAME BROWSER_DIALOG_TITLE;
SCALE_H; SCALE_V;
GROUP PARENT_GROUP {
SCALE_H; SCALE_V;
ALLOW_WEIGHTS;
TAB TAB_GROUP {
SELECTION_TABS;
SCALE_H; SCALE_V;

GROUP TAB_ONE_GROUP {
NAME TAB_ONE_NAME;
SCALE_H; SCALE_V;
}
GROUP TAB_TWO_GROUP{
NAME TAB_TWO_NAME;
SCALE_H; SCALE_V;
}
}

SCROLLGROUP SCROLL_GROUP {
SCALE_H; SCALE_V;
SIZE 1200,500;
SCROLL_V;
CONTENTCUSTOMGUI OBJECTS_GROUP { 
}
}
}
}

Here is how I add the treeviews in tab groups.
BaseContainer temp_cont;
tree_view_gui = (TreeViewCustomGui*)AddCustomGui(tree_param_id, CUSTOMGUI_TREEVIEW, String(), BFH_LEFT | BFV_TOP | BFH_SCALE | BFV_SCALE, 500, 500, temp_cont);

1) The first problem is that even though I set BFH_SCALE, the tree view doesn't "fill" the group and it causes unecessary scroll bars to appear (even though there is still space available).

2) The other problem I have is in OBJECTS_GROUP where I want to show the selected content. This custom gui should have undefined size. It can either be huge or small, depending on the amount of data it contains.
If it's larger than the Dialog height, I want a vertical scroll bar to appear.
The problem is that to make the scrollbar appear, I have to pre-define its size to something bigger than dialog's height (e.g. SIZE 500, 1200).
It seems that I have to use AddCustomGui here with size depending on the content I want to show, right ?

I have checked the Layer Shader Browser because I need something similar to that, but I'm stuck to these 2 problems above.

Thank you for your time and sorry for the long post !
Back to Top
kuroyume0161 View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 29
Location: United States
Online Status: Offline
Posts: 3665
Post Options Post Options   Quote kuroyume0161 Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Oct 09 at 5:12am
This may not be very helpful, but I have avoided using a .res file for dialog ui construction for at least a decade.  My dialog GUIs are always built in CreateLayout() (and sub-methods for the more massive interfaces).  Also realize that you only have limited control over the general layout since the interface is controlled more by the underlying API.

From my experience, you may need to be 'group happy' to get a layout that looks and acts more like what you expect.  BFx_SCALE, BFx_FIT, and BFx_SCALEFIT may need to be used in varying group levels and in particular ways - even today, I am no expert on the best combination without trial-and-error builds and runs.

Don't forget about ScrollArea() and Sized() in any GeUserAreas used in the dialog.
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1599
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Oct 11 at 10:23am
Hi,

first of all, sorry for letting you wait. 

1) I think, you are lacking BFH_FIT and BFV_FIT (or directly BFH_SCALEFIT and BFV_SCALEFIT), when adding the TreeView CustomGUI.

2) Usually the content of a ScrollGroup needs to be enclosed in an additional group. Now, with a CustomGUI it gets a bit difficult to say more without knowing anything about its design and structure. Is there a GeUserArea involved? Robert already gave a few hints in that case. So please provide me with a few more details , so we can proceed.
Cheers,
Andreas
SDK Support Engineer
Back to Top
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 309
Post Options Post Options   Quote peterakos Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Oct 11 at 1:32pm
Hello.

First of all thank you for your help ! 
I followed your advice Robert and I implemented everything in CreateLayout without using a resource file. It works great and eliminates some issues I had before. 

1) Adding Fit indeed solves the problem, but I cannot understand why :(
Isn't scale parameter supposed to extend the element and cover the whole area ? Fits handles the alignment right ?

2) Custom Gui consists of a GeUserArea. I use this dialog as a Content Browser. Once you click a filter in the TreeView, the Custom Gui is filled with thumbnails. The problem here is that since I don't know the exact number of objects, I cannot use a const height for the custom GUI. If the height is big and the objects are a few, the whole scrollable area will appear almost empty. If we have many objects and the user are is small, they will not fit in it.  What I do is to AddCustomGui everytime a new filter is clicked. That way the objects are counted and I adjust the Custom Gui height accordingly.

Thank you.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.109 seconds.