(solved) AutoXYWH function - Y axis Resize bug [cause Tab3] Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
DRocks
Posts: 89
Joined: 08 May 2018, 10:20

(solved) AutoXYWH function - Y axis Resize bug [cause Tab3]

15 Sep 2018, 09:39

Hi guys,

I'm creating a Calculation table in a GUI and placing buttons where they need to be.
Then I use Auto XYWH function to act upon GUI SIZE: gLabel.

Problem is: When I have controls assigned to be positionned according to these two parameters: x + y, Resizing the GUI only Horizontally without touching the Y will drop the controls down and get out of the GUI window by a few pixels. The only it wont do it is to not make them affected by the Y resizing but I need it...

Any idea what in the function would be causing this issue?
PS: please tell me if need more precision on the context and script thanks

Before:
Image

After X stretch only:
Image

Bug:

Code: [Select all] [Download] GeSHi © Codebox Plus

AutoXYWH("*x0.5 y0.8", "DEPENSES_SOUSTOTAL_text", "DEPENSES_SOUSTOTAL", "DEPENSES_TPS_text", "DEPENSES_TPS", "DEPENSES_TVQ_text", "DEPENSES_TVQ", "DEPENSES_TOTAL", "DEPENSES_TOTAL_text", "DEPENSES_CONFIRMER")


Separating on two lines doesnt work either because it deactivates one of them:

Code: [Select all] [Download] GeSHi © Codebox Plus

AutoXYWH("*x0.5", "DEPENSES_SOUSTOTAL_text", "DEPENSES_SOUSTOTAL", "DEPENSES_TPS_text", "DEPENSES_TPS", "DEPENSES_TVQ_text", "DEPENSES_TVQ", "DEPENSES_TOTAL", "DEPENSES_TOTAL_text", "DEPENSES_CONFIRMER")
AutoXYWH("*y0.8", "DEPENSES_SOUSTOTAL_text", "DEPENSES_SOUSTOTAL", "DEPENSES_TPS_text", "DEPENSES_TPS", "DEPENSES_TVQ_text", "DEPENSES_TVQ", "DEPENSES_TOTAL", "DEPENSES_TOTAL_text", "DEPENSES_CONFIRMER")


Thanks :)
Last edited by DRocks on 15 Sep 2018, 16:08, edited 2 times in total.
tmplinshi
Posts: 1242
Joined: 01 Oct 2013, 14:57

Re: Auto XYWH function (x0.5 + y0.8) bugs Y axis Resizing

15 Sep 2018, 12:14

I can't reproduce the bug.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Could you post an example code?
DRocks
Posts: 89
Joined: 08 May 2018, 10:20

Re: Auto XYWH function (x0.5 + y0.8) bugs Y axis Resizing

15 Sep 2018, 12:27

Thanks for your reply!!
Ill do this and edit post :)

EDIT: I'm very sorry but I can't break down the gui because all variables are interdependant.
Before editing post I tried lots of other possibilities and nothing fixed it.

But you're perfectly right that your script example can't reproduce the bug! So its interesting.



heres is the overwelming script: seriously im sorry to have to post it all

- the function autoXYWH is at line 533
- the portion of the GUI that moves on Y incorrectly is between line 224-251
- the GuiSize Label is between 393-420 (where I call AutoXYWH
- The exact problematic lines is at 416

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Sorry this is a script in progress and very noob GUI coded
You might not see the included images for the top layer

thanks alot man
DRocks
Posts: 89
Joined: 08 May 2018, 10:20

Re: Auto XYWH function (x0.5 + y0.8) bugs Y axis Resizing

15 Sep 2018, 13:10

I found it!!

The problem resolves when I De-activate the Tab3 Control that the controls are dependent on! Damn it whats this lol


EDIT: Tab1 and Tab2 models dont have a background and they don't introduce the problem but Tab3 has a background and bugs
if the Tab3 is activated but the controls are not atribbuted to BELONG to any tabs, it will not bug

Should I just get rid of a Tab anyway??
I only need swaping controls when I click on the pictures I use as custom Tab Selectors. But I thought I could only do this easily by using Tabs and making controls belong to one of these


EDIT: Btw thanks for your Gui example... it just showed me how more intelligently I can create identical increments with loops! :)
tmplinshi
Posts: 1242
Joined: 01 Oct 2013, 14:57

Re: Auto XYWH function (x0.5 + y0.8) bugs Y axis Resizing  Topic is solved

15 Sep 2018, 15:29

I found the reason. The controls under Tab3 need to use relative positions for repositioning. @lexikos Is this a bug?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



I added a ! symbo option to AutoXYWH to fix the problems with Tab3 control.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

DRocks
Posts: 89
Joined: 08 May 2018, 10:20

Re: AutoXYWH function - Y axis Resize bug [cause found Tab3]

15 Sep 2018, 16:07

Wow.

This is what I call impressive knowledge. Seriously how can you be so smart as to fix this and make it so simple that only ! fix it :D
Im exagerating a bit but this is genious. One of my most impressive tool cause I know how complex calculating manually all the proportions is!

thanks man!

On the same topic: Do you have a clue how we could reduce flickering apart from introducing a sleep before refreshing?

Edit: typos
tmplinshi
Posts: 1242
Joined: 01 Oct 2013, 14:57

Re: AutoXYWH function - Y axis Resize bug [cause found Tab3]

16 Sep 2018, 12:53

DRocks wrote:Do you have a clue how we could reduce flickering apart from introducing a sleep before refreshing?

Maybe use Tab2 instead? You can set w0 h0 to Tab2 control, and set the GUI color to white.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

DRocks
Posts: 89
Joined: 08 May 2018, 10:20

Re: (solved) AutoXYWH function - Y axis Resize bug [cause Tab3]

16 Sep 2018, 14:10

thanks. In your example if I add AutoXYWH you're right it doesnt flicker at all. But it will start doing so when you add buttons and edits.

I have noticed in my script that your trick will reduce like 20% of the flicker but the real problem is redrawing. It doesnt flicker when theres no redrawing, but the end result will mess up the GUI positions. Some overlay, some need total redrawing, etc.

So its kind of a downside of redrawing the controls. The refresh rate is visible. We can reduce the flickering intensity by adding like 200ms of sleep for each GuiSize request but it makes it feel laggy when you resize. I dont think its better than the flickering.

Let me know if you think of something else, in the mean time its not a major problem.
tmplinshi
Posts: 1242
Joined: 01 Oct 2013, 14:57

Re: (solved) AutoXYWH function - Y axis Resize bug [cause Tab3]

17 Sep 2018, 12:28

Adding WS_CLIPCHILDREN style to the control's parent window seems fixes a lot of flickering.

Tab2 Demo:

Code: [Select all] [Expand] [Download] (Tab2 Demo.ahk)GeSHi © Codebox Plus



Tab3 Demo:
For Tab3 control, is kind of tricky.
  • You can hide the Tab3 header, by using WinHide. (Note: GuiControl, Hide Will hide the entire Tab3 area)
  • Unlike Tab2 control, the Tab3 control has a container for its child controls (Screenshot). You'll need adding WS_CLIPCHILDREN style to this container.

Code: [Select all] [Expand] [Download] (Tab3 Demo.ahk)GeSHi © Codebox Plus

DRocks
Posts: 89
Joined: 08 May 2018, 10:20

Re: (solved) AutoXYWH function - Y axis Resize bug [cause Tab3]

17 Sep 2018, 17:14

Dude, this is a nightmare for me when there are classes. But you make it so clear that I think I get classes a bit more.
This solution seems to work on the example script! If I am able to integrate \ rewrite my GUI I'll test it properly.

In the example of Tab3 it flickers I'd say like 80% less than without your solution

thanks so much for investing time in this topic.
I'll keep studying your class and try to figure out how to use something similar in my own GUI that is very messy. I get lost myself in it because I was working with variables for almost each controls so its really confusing. And I also did not use loops for repeats. anyways thank you :)
DRocks
Posts: 89
Joined: 08 May 2018, 10:20

Re: (solved) AutoXYWH function - Y axis Resize bug [cause Tab3]

17 Sep 2018, 18:26

seems to mess up with the controls that have background transparency :(



Image

And to be honest my script is too confusing to integrate a new thing I just get lost so I've stopped after 30 minutes of trial and error.

Return to “Ask For Help”

Who is online

Users browsing this forum: cjj, FanaticGuru, KiritoSanPlays and 77 guests