How to use ResizerWidget in Dlangui app..?
ShadoLight
ettienne.gilbert at gmail.com
Wed Jan 1 17:11:32 UTC 2020
On Wednesday, 1 January 2020 at 10:52:02 UTC, Ron Tarrant wrote:
> On Monday, 30 December 2019 at 23:32:37 UTC, ShadoLight wrote:
>> dragging with the left mouse button does nothing.
>
>> Window window = Platform.instance.createWindow("DlangUI
>> example", null);
>
> I'm not familiar with this toolkit, but my guess is that you
> didn't pass in a `flags` value and therefore you aren't using
> the appropriate overload of the createWindow() function to
> achieve what you're after.
>
> The following is from the DLangUI GitHub site
> (https://github.com/buggins/dlangui/wiki/Getting-Started). Take
> a look at the third argument:
>
> Window createWindow(
> dstring windowCaption, // window caption
> Window parent, // parent window, pass null for main
> (first) window.
> uint flags = WindowFlag.Resizable, // various flags - bit
> fields from WindowFlag enum values
> uint width = 0, // initial window width
> uint height = 0 // initial window height
> );
Thanks for the reply, Ron.
Yes, as you say WindowFlag.Resizable is the default value for the
'flags' argument in the createWindow call, so that was the
setting I had.
But the problem is actually not in resizing the full app window
(that actually works - including keeping the relative proportions
of the widget children sizes), but rather in resizing 2 widgets
that are separated by a ResizerWidget inside the app window. The
app window size should actually not be affected since, as 1
widget on one side of the ResizerWidget shrinks by N pixels in
height or width (depending on the orientation of the
ResizerWidget), the opposite widget should grow by the same N
pixels in height/width, leaving the parent size unaffected.
I can see that is actually what is coded, but it is not working
when I run the app.
But I thought you may be on to something and I should check if
children widgets of the app window inherits some settings from
the parent, so I checked the WindowFlag flags. According to [1]
you can have:
- Fullscreen
- Modal
- Resizable
However, checking the code there are additional options:
/// window creation flags
enum WindowFlag : uint {
/// window can be resized
Resizable = 1,
/// window should be shown in fullscreen mode
Fullscreen = 2,
/// modal window - grabs input focus
Modal = 4,
/// measure window size on window.show() - helps if you want
scrollWindow but on show() you want to set window to mainWidget
measured size
MeasureSize = 8,
/// window without decorations
Borderless = 16,
/// expand window size if main widget minimal size is greater
than size defined in window constructor
ExpandSize = 32,
}
So it looks like the documentation isn't completely up to date
either. Anyway, I also tried to pass WindowFlag.Resizable |
WindowFlag.MeasureSize as flags argument in the call to
createWindow, but it did not help.
I was hoping for a quick answer on the forum from someone who has
run into the same, but I think I'm going to need to dig into
dlangui code to figure out what is going wrong.
[1]:
http://buggins.github.io/dlangui/ddox/dlangui/platforms/common/platform/WindowFlag.html
More information about the Digitalmars-d-learn
mailing list