Overlay GUI elements possible? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

Overlay GUI elements possible?

14 Feb 2023, 08:22

Dear experts
I have a script in which tool bar icons are collected. Since the user may arrange more than 15 on his tool tool bar, I need a method to show those with nr > 15 'wrapped around' to avoid a GUI of excessive width. This screenshot just shows a collection of 3, but ...
Image
I tried to overlay the additonal icons/texts by restarting the x coordinate. but this does not work. Hence I made a test program just using the text portion of the problem':

Code: Select all

; OverlayGuiItems.ahk
  Gui AA:Add, Text   , x020 y010 w30 h020 , 1
  Gui AA:Add, Text   , x050 y010 w30 h020 , 2
  Gui AA:Add, Text   , x080 y010 w30 h020 , 3
  Gui AA:Add, Text   , x020 y010 w30 h020 , 4
  Gui AA:Add, Text   , x050 y010 w30 h020 , 5
  Gui AA:Show ,  h070 w200, With static coordinates the overly works
  jNew := 0
  w := 20
  Loop 5{
    If (Mod(jNew, 3) == 0) {
      newBtnX := 20 - w
    }
    jNew += 1                                                 ; number of new button
    newBtnX += w                                              ; increment location
;   Gui BB:Add, Text   , x%newBtnX%+20 y050 w%w% h020 , %jNew%
; }
; Gui BB:Show , h070 w200, Separate GUI with dynamic coordinates OK
    Gui AA:Add, Text   , x%newBtnX%+20 y050 w%w% h020 , %jNew%
  }
  Gui AA:Show , h070 w200, Same GUI with dynamic coordinates NOT OK

MsgBox What's going on?
ExitApp
With two independent GUIs (exchange the commented with the active code) the second GUI works similar to the first - no surprise.
Image
But running the code as it is active in the above snippet (only one GUI exists) does not show the wrapped items
Image

How can I make this to work as expected?
Klaus Daube, Zürich, CH
just me
Posts: 9576
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Overlay GUI elements possible?  Topic is solved

14 Feb 2023, 08:55

Seemingly, the second Gui AA:Show doesn't redraw the window 'completely'. I don't kwow what's actually wrong.

It works, if you remove the first Gui AA:Show or add a Winset, Redraw, ... after the second:

Code: Select all

; OverlayGuiItems.ahk
  Gui AA:+LastFound
  Gui AA:Add, Text   , x020 y010 w30 h020 , 1
  Gui AA:Add, Text   , x050 y010 w30 h020 , 2
  Gui AA:Add, Text   , x080 y010 w30 h020 , 3
  Gui AA:Add, Text   , x020 y010 w30 h020 , 4
  Gui AA:Add, Text   , x050 y010 w30 h020 , 5
  Gui AA:Show ,  h070 w200, With static coordinates the overly works
  jNew := 0
  w := 20
  Loop 5{
    If (Mod(jNew, 3) == 0) {
      newBtnX := 20 - w
    }
    jNew += 1                                                 ; number of new button
    newBtnX += w                                              ; increment location
;   Gui BB:Add, Text   , x%newBtnX%+20 y050 w%w% h020 , %jNew%
; }
; Gui BB:Show , h070 w200, Separate GUI with dynamic coordinates OK
    Gui AA:Add, Text   , x%newBtnX%+20 y050 w%w% h020 , %jNew%
  }
  Gui AA:Show , h070 w200, Same GUI with dynamic coordinates NOT OK
  MsgBox What's going on?
  WinSet, Redraw
  MsgBox Any change?
ExitApp
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

Re: Overlay GUI elements possible?

14 Feb 2023, 10:40

Thanks You very much, YustMe,
The Winset does the trick in my script!
Klaus Daube, Zürich, CH

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: macromint, peter_ahk and 354 guests