First unread post8 posts Page 1 of 1
Unread postby Yin Cognyto » 08 Jul 2018 23:07
Here is a simplified version of my code:
Code: Select all
<Static State='CMD_ON_MEDIA_PLAY' Left='0' Top='-80' Height='16' AutoSize='1' ImageLeft='870' ImageTop='48' ImageWidth='11' ImageHeight='64' LeftMargin='1' RightMargin='1' HoriCenter='1' >
<Button Align='Left' Tooltip='$CMD_POPUPMENU_FILTER' CmdID='CMD_POPUPMENU_FILTER' Width='64' Height='16' ImageLeft='580' ImageTop='810' Cursor='HAND' VisParentMinWidth='-1' >
<Label CmdID='CMD_VIDEO_CODEC_FOURCC_MESSAGE' Width='64' Height='16' FontName='#DEFAULT_UI_FONT' FontSize='12' TextColor='0xFFFFFF' PushTextColor='0x000000' UsingScroll='1' ScrollDistance='1' ScrollInterval='50' HoriAlignment='1' />
</Button>
<Button Align='Left' Tooltip='$CMD_POPUPMENU_VIDEO_DEVICE' CmdID='CMD_POPUPMENU_VIDEO_DEVICE' Width='64' Height='16' ImageLeft='580' ImageTop='810' Cursor='HAND' VisParentMinWidth='-1' >
<Label Text='%s kbps' CmdID='CMD_VIDEO_BIT_RATE_MESSAGE' Width='64' Height='16' FontName='#DEFAULT_UI_FONT' FontSize='12' TextColor='0xFFFFFF' PushTextColor='0x000000' UsingScroll='1' ScrollDistance='1' ScrollInterval='50' HoriAlignment='1' />
</Button>
<Button Align='Left' Tooltip='$CMD_POPUPMENU_VIDEO_FILTER' CmdID='CMD_POPUPMENU_VIDEO_FILTER' Width='64' Height='16' ImageLeft='580' ImageTop='810' Cursor='HAND' VisParentMinWidth='-1' >
<Label Text='%s px' CmdID='CMD_VIDEO_CODEC_SIZE_MESSAGE' Width='64' Height='16' FontName='#DEFAULT_UI_FONT' FontSize='12' TextColor='0xFFFFFF' PushTextColor='0x000000' UsingScroll='1' ScrollDistance='1' ScrollInterval='50' HoriAlignment='1' />
</Button>
</Static>
Basically I am horizontally centering a whole group of buttons in the PotPlayer window, so that they look aesthetically pleasing and symmetrical. It all works as expected, but I would like to "hide" various individual buttons according to the width of the PotPlayer window while keeping the whole group centered (i.e. the visible buttons should "fill the gap" left by the hidden ones and the group should automatically "re-center" itself accordingly).

As you can see, I have tried with VisParentMinWidth='[width value]', but since the buttons are in a <Static State='CMD_ON_MEDIA_PLAY'> container that has AutoSize='1' (so that it adjusts to new widths after buttons are hidden and center itself afterwards), its width is not the actual PotPlayer window width, so it doesn't work - that's the reason I left VisParentMinWidth='-1' in the code above.

I tried to make it work without the <Static State='CMD_ON_MEDIA_PLAY'> container (e.g. with the buttons directly on a full width container), but I don't know how to center the whole group (not just individual buttons) and also aligning the buttons one after another without breaking the group's centering. I also tried with VisMinWidth='[width value]', but this one seems to react on the width of the button itself, not its top parent container...

Any help is appreciated.
Unread postby D2NP » 09 Jul 2018 01:53
"... but I don't know how to center the whole group (not just individual buttons) ..."
support only individual buttons

make a different container
<Static ... VisParentMaxWidth='' VisParentMinWidth='600' >
<Button 1 ...
<Button 2 ...
<Button 3 ...
</Static>

<Static ... VisParentMaxWidth='601' VisParentMinWidth='550' >
<Button 1 ...
<Button 2 ...
</Static>

<Static ... VisParentMaxWidth='551' VisParentMinWidth='' >
<Button 1 ...
</Static>
...

but, static containers appear\hide with little delay
so, it is better to do this simply with buttons, without using static containers

need duplicated buttons with different values VisParentMaxWidth='[]' VisParentMinWidth='[]'

<Button 1 ... VisParentMaxWidth='' VisParentMinWidth='600' />
<Button 1 ... VisParentMaxWidth='601' VisParentMinWidth='550' />
<Button 1 ... VisParentMaxWidth='551' VisParentMinWidth='350' />

<Button 2 ... VisParentMaxWidth='' VisParentMinWidth='600' />
<Button 2 ... VisParentMaxWidth='601' VisParentMinWidth='550' />
<Button 2 ... VisParentMaxWidth='551' VisParentMinWidth='350' />

....

but this is if the buttons do not have AutoSize, to look good
Always try the latest beta version (x32 only) before continuing a discussion here.
When you have a problem (Follow steps 1,2,3)
This is NOT official support though. It is my contribution to Potplayer.
Unread postby Yin Cognyto » 09 Jul 2018 04:26
Let me see if I understood this correctly: the first option you presented works in centering the whole group and hide individual buttons (the only disadvantage is the delay), while the second can't center the group (since the buttons are separate), am I right?

If I understood it like the above, then I'll choose the first option, since centering is key to make it look reasonably good ... unless you know a way of making the widths of the buttons proportional with the width of the window (if you do, please tell).

Regarding the containers ... I don't really need them to be <Static> ones. I can use any type of container, as long as it can hold buttons and center itself. Is <Static> the only type of container that can hold buttons, or there are others that can do that as well (and maybe don't have the delay you talked about when appearing/hiding)?
Unread postby D2NP » 09 Jul 2018 19:12
check this example-


"hide individual buttons (the only disadvantage is the delay),"
hide static containers with delay

"while the second can't center the group (since the buttons are separate), am I right?"
Yes, right

Only <Static can hold elements with which you can interact.
You can place elements in elements, but only the parent element will be available for interaction.
Always try the latest beta version (x32 only) before continuing a discussion here.
When you have a problem (Follow steps 1,2,3)
This is NOT official support though. It is my contribution to Potplayer.
Unread postby Yin Cognyto » 09 Jul 2018 21:36
Thank you very much for the example - this is exactly the way I want the container and buttons to look and behave. You didn't have to actually code it though, since I realized how to do it from the explanation in your previous reply - I just wasn't sure if I understood the explanation correctly, that's all :D

The delay doesn't bother me at all, it isn't long. The only thing I would have preferred was for the code to be less redundant / repetitive, but that's a small "price" to pay for a working solution, so that's ok.
Unread postby Yin Cognyto » 10 Jul 2018 05:40
Hey D2NP, I tested your example while enabling OSC, and in D3D9 and OpenGL the button group doesn't center until I either go full screen or resize PotPlayer's window. This happens also in the skin I'm working on, where I didn't yet make the modifications you suggested. Is this normal or is it a bug? It isn't about the delay, it's about the fact that it doesn't center at all in those modes until I make modifications on the window size (i.e. full screen or drag to resize).

By the way, in OSC - Layered Window Mode it works as expected, no problem there.
Unread postby D2NP » 10 Jul 2018 21:33
Yin Cognyto wrote:... the button group doesn't center ...

Fixed in beta 1.7.13341
Always try the latest beta version (x32 only) before continuing a discussion here.
When you have a problem (Follow steps 1,2,3)
This is NOT official support though. It is my contribution to Potplayer.
Unread postby Yin Cognyto » 10 Jul 2018 23:00
D2NP wrote:
Yin Cognyto wrote:... the button group doesn't center ...

Fixed in beta 1.7.13341
Wow, that was fast! :shock: Nice job for the developer.
First unread post8 posts Page 1 of 1

Login

Who is online

Users browsing this forum: No registered users and 1 guest

cron