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

Dialog size

Author
Message
  Topic Search Topic Search
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 349
Direct Link To This Post Topic: Dialog size
    Posted: 2018 Aug 28 at 1:33am

User Information:

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

---------

Hello.

I have a resizable dialog and I need to know its width and height. 
Is there a way to do it in Message method listening to BFM_SIZED ?
In general, how else can I know its size ?

Thank you.
Petros.


Edited by peterakos - 2018 Aug 28 at 1:35am
Back to Top
WickedP View Drop Down
Member
Member
Avatar

Joined: 2011 Aug 21
Online Status: Offline
Posts: 479
Direct Link To This Post Posted: 2018 Aug 29 at 12:44am
Hi Petros,

maybe take a look at the GetItemDim() function. You could call it on your parent dialog group - might get what you're after?

WP.
WickedP® Developer
http://www.wickedp.com
Back to Top
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 349
Direct Link To This Post Posted: 2018 Aug 29 at 4:48am
Hello.

GetItemDim() works fine ! It returns the size of the requested ID.
There is another problem though if used in Message listening to BFM_SIZED.
If I double click the Dialog's Title bar causing the dialog to be maximized, it returns the previous width (not the maximized one).
So it appears that BFM_SIZED is not the right message to use in order to retrieve the correct Param width. I need the size after the resizing.

Thank you.

Back to Top
MaximeA View Drop Down
Forum Moderator
Forum Moderator

Forum Moderator

Joined: 2018 Jan 04
Location: France - Nantes
Online Status: Offline
Posts: 119
Direct Link To This Post Posted: 2018 Aug 30 at 9:05am
Hi Peterakos,

Sorry for the delay, even if it's marked as private you can use BFM_ADJUSTSIZE as bellow to know the current size of the windows.
Int32 YourGeDialog::Message(const BaseContainer& msg, BaseContainer& result)
{
switch (msg.GetId())
{
case BFM_ADJUSTSIZE:
{
Int32 w = msg.GetInt32(BFM_ADJUSTSIZE_WIDTH);
Int32 h = msg.GetInt32(BFM_ADJUSTSIZE_HEIGHT);
break;
}
}
return GeDialog::Message(msg, result);
}

If you have any questions, please let me know.
Cheers,
Maxime!
MAXON
SDK Specialist
Back to Top
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 349
Direct Link To This Post Posted: 2018 Sep 03 at 6:05am
Hello.

Please allow me to add another question related to this topic.

I have a dialog and as I resize it, I Flush a specific Group inside that dialog (via LayoutFlushGroup) and I add all of its controls again based on the Group's width.
As you can see I need the group's width. With GetItemDim(), I can retrieve the dialog's size correctly, but if I use it for any of its inner groups, I get width 0.
How can I get the correct size of a dialog's group ?

Thank you. 

Back to Top
WickedP View Drop Down
Member
Member
Avatar

Joined: 2011 Aug 21
Online Status: Offline
Posts: 479
Direct Link To This Post Posted: 2018 Sep 04 at 1:28am
Hi Petros,

if you've called GetItemDim() after flushing the group and before it's rebuilt then there won't be any size width I wouldn't have thought. When are you calling this? After LayoutChanged()?

However, you may not need to be flushing your elements if you're just resizing the dialog.

Could you setup your dialog elements so they resize dynamically? I.e. using flags like BFH_SCALEFIT instead of sizes? Might be something to try

If not, you might have to apply weighting to your groups. I've had to do this in one of my dialogs (which worked to great effect!). Something like:

BaseContainer Dialog_Weights;

Dialog_Weights.SetLong(GROUPWEIGHTS_PERCENT_W_CNT,1);        // number of columns
Dialog_Weights.SetReal(GROUPWEIGHTS_PERCENT_W_VAL+0,100.0);  // column 1 width
Dialog_Weights.SetLong(GROUPWEIGHTS_PERCENT_H_CNT,4);        // number of rows
Dialog_Weights.SetReal(GROUPWEIGHTS_PERCENT_H_VAL+0,-24.0);  // set row 1
Dialog_Weights.SetReal(GROUPWEIGHTS_PERCENT_H_VAL+1,100.0);  // set row 1
Dialog_Weights.SetReal(GROUPWEIGHTS_PERCENT_H_VAL+2,-44.0);  // set row 1
Dialog_Weights.SetReal(GROUPWEIGHTS_PERCENT_H_VAL+3,-242.0); // set row 1

GroupWeightsLoad(DLG_GROUP_ID,Dialog_Weights);

// number of columns must be equal to number in given group layout
// number of rows must be equal to number in given group layout
// minus numbers are pixels, positive numbers are percentage
// numbers don't have to add up to 100

There's more in the sdk on group weights, take a look at GroupWeightsLoad() and similar.

WP.
WickedP® Developer
http://www.wickedp.com
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2018 Sep 05 at 12:50am
Hi,

as WP already pointed out, empty groups have no dimensions.Not sure the weighting approach will help, as you seem to be after some dynamically changing multi-column layout. The content browser for example, showing an arbitrary number of icons per row, achieves this with a GeUserArea.

Just in case you haven't noticed, yesterday we started the new Plugin Café forum. This one here will go into read-only mode soon. Please come over, register in the new forum, so we can continue discussions there.
Cheers,
Andreas
SDK Support Engineer
Back to Top

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.098 seconds.