Darstellungsprobleme bei GuiSize + AutoXYWH Topic is solved

Stelle Fragen zur Programmierung mit Autohotkey

Moderator: jNizM

Nmk
Posts: 28
Joined: 20 Jan 2017, 19:29

Darstellungsprobleme bei GuiSize + AutoXYWH

04 Apr 2017, 05:01

Hallo,

wenn ich die Größe einer Gui wird die Darstellung etwas verzerrt. Es wirkt so als würden Ebenen übereinander legen. Ich weiß nicht, ob ein Zusammenhang mit AutoXYWH besteht. Wenn ich die Maximize Schaltfläche verwende klappt es einwandfrei.

So sieht das dann aus:
TestGuiSizeAutoXYWH.png
TestGuiSizeAutoXYWH.png (3.09 KiB) Viewed 2002 times

Code: Select all

; Generated by AutoGUI 1.3.3a
#NoEnv
#Warn
#SingleInstance Force
SetWorkingDir %A_ScriptDir%
#Include %A_ScriptDir%\AutoXYWH.ahk

Gui New, +Resize
Gui Add, Radio, hWndhButton1 x100 y5 w80 h30 Border, Radio 1
Gui Add, Radio, hWndhButton2 x+5 y5 w80 h30 Border, Radio 2
Gui Add, Radio, hWndhButton3 x+5 y5 w80 h30 Border, Radio 3
Gui Show, w355 h40, Test GuiSize + AutoXYWH
Return

GuiSize:
    If (A_EventInfo == 1) {
        Return
    }

    AutoXYWH("x", hButton1)
    AutoXYWH("x", hButton2)
    AutoXYWH("x", hButton3)
Return

GuiEscape:
GuiClose:
    ExitApp

; Do not edit above this line
Kann ich das irgendwie verhindern?

Gruß

Nmk
Nmk
Posts: 28
Joined: 20 Jan 2017, 19:29

Re: Darstellungsprobleme bei GuiSize + AutoXYWH

06 Apr 2017, 01:57

Liegt es vielleich an meinem System?
just me
Posts: 9451
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Darstellungsprobleme bei GuiSize + AutoXYWH

06 Apr 2017, 02:49

Ich benutze das nicht. Du solltest aber wohl zumindest die Zeile

Code: Select all

SetBatchLines, -1
oben hinzufügen.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Darstellungsprobleme bei GuiSize + AutoXYWH

06 Apr 2017, 03:14

Ich denke, daß Buttons den Redraw brauchen. Versuch mal mit * beim x:

Code: Select all

    AutoXYWH("x*", hButton1)
    AutoXYWH("x*", hButton2)
    AutoXYWH("x*", hButton3)
Ich hoffe das hilft.
just me
Posts: 9451
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Darstellungsprobleme bei GuiSize + AutoXYWH

06 Apr 2017, 03:25

Ja, ich habe das auch gerade ausprobiert. Und das hilft noch ein wenig mehr:

Code: Select all

GuiSize:
    If (A_EventInfo == 1) {
        Return
    }
    ; add a '*' to DimSize to 'MoveDraw' the controls rather then just 'Move', this is recommended for Groupboxes
    AutoXYWH("*x", hButton1, hButton2, hButton3)
Return
Nmk
Posts: 28
Joined: 20 Jan 2017, 19:29

Re: Darstellungsprobleme bei GuiSize + AutoXYWH

06 Apr 2017, 07:00

Top! Works like a charm! Vielen Dank.

Code: Select all

SetBatchLines, -1
habe ich trotzdem mal hinzugefügt.

Wo ich gerade die Groupbox lese. Hier habe ich auch ein merkwürdiges verhalten:

Code: Select all

; Generated by AutoGUI 1.3.3a
#NoEnv
#Warn
SetWorkingDir %A_ScriptDir%
#Include %A_ScriptDir%\AutoXYWH.ahk

Gui New, +Resize
Gui Add, GroupBox, hWndhButton1 x280 y164 w240 h140, 
Gui Add, Edit, x297 y192 w205 h21, Edit
Gui Add, Edit, x297 y223 w205 h21, Edit
Gui Add, Button, x297 y255 w100 h23, Exit
Gui Add, Button, x399 y255 w100 h23, &OK
Gui Show, w800 h468, Window
Return

GuiSize:
    If (A_EventInfo == 1) {
        Return
    }

    AutoXYWH("xy", hButton1)
Return

GuiEscape:
GuiClose:
    ExitApp

; Do not edit above this line
Hier hat mir gefallen, dass die Controls innerhalb der Groupbox einfach automatisch mit positioniert werden. Dabei werden die Elemente aber doppelt dargestellt. Aber ich denke ich muss hier sowieso anders vorgehen, da AutoXYWH bei Größenänderung nicht vertikal und horizontal zentriert positionieren kann, richtig?
just me
Posts: 9451
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Darstellungsprobleme bei GuiSize + AutoXYWH

06 Apr 2017, 08:00

Das ist ein ähnliches Problem. Weil die GroupBox mangels Option * nicht neu gezeichnet wird, bleiben die auf ihr bereits gezeichneten Controls erhalten, allerdings nur als funktionsloses Abbild.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Darstellungsprobleme bei GuiSize + AutoXYWH  Topic is solved

06 Apr 2017, 08:47

Versuch mal:

Code: Select all

    AutoXYWH("*x0.5y0.5", hButton1)
    AutoXYWH("x0.5y0.5", "Edit1", "Edit2")
    AutoXYWH("x0.5y0.5", "Button2", "Button3")
Ich hoffe das hilft.
Nmk
Posts: 28
Joined: 20 Jan 2017, 19:29

Re: Darstellungsprobleme bei GuiSize + AutoXYWH

07 Apr 2017, 01:31

Perfekt! Vielen Dank!

Code: Select all

; Generated by AutoGUI 1.3.3a
#NoEnv
#Warn
SetWorkingDir %A_ScriptDir%
#Include %A_ScriptDir%\AutoXYWH.ahk

Gui New, +Resize
Gui Add, GroupBox, hWndhButton1 x280 y164 w240 h140, 
Gui Add, Edit, x297 y192 w205 h21, Edit
Gui Add, Edit, x297 y223 w205 h21, Edit
Gui Add, Button, x297 y255 w100 h23, Exit
Gui Add, Button, x399 y255 w100 h23, &OK
Gui Show, w800 h468, Window
Return

GuiSize:
    If (A_EventInfo == 1) {
        Return
    }

    AutoXYWH("*x0.5y0.5", hButton1)
    AutoXYWH("x0.5y0.5", "Edit1", "Edit2")
    AutoXYWH("x0.5y0.5", "Button2", "Button3")
Return

GuiEscape:
GuiClose:
    ExitApp

; Do not edit above this line
Gruß

Nmk

>>> Huch, man kann ja gar nicht mehrere Beträge als Lösung markieren. Geholfen hat mir jeder Beitrag.

Return to “Ich brauche Hilfe”

Who is online

Users browsing this forum: No registered users and 14 guests