Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

i need gui expert help here please.


  • Please log in to reply
4 replies to this topic
Light
  • Guests
  • Last active:
  • Joined: --

#NoEnv
SetBatchLines -1
SetControlDelay 0

; Put in the char you want
STR := "###"
LEN := StrLen(STR)
; Increase/decrease for slower/faster
SLP := 25

; Create the Gui
Gui, 2:+LabelGUI2_
Gui, 2:Margin, 20, 20
Gui, 2:Font, s22 cWhite Bold, Arial
Gui, 2:Add, Text, vGUI2_TX , %STR%
GuiControlGet, TX, Pos, GUI2_TX
GuiControl, Move, GUI2_TX, % "x" TXX "y" TXY "h" TXH "w0"
Gui, 2:Show, , % "  :)"

; Let's roll
D := (TXW + (StrLen(STR) - 1)) // StrLen(STR)
X := TXX
FX := 0
W := 0
FW := +1
Loop {
   Sleep, %SLP%
   W += (D * FW)
   If (W > TXW) {
      W := TXW - D
      FW := -1
      If (FX = 0) {
         X := TXX
         FX := +1
      } ELSE {
         FX := 0
      }
   }
   If (W < 0) {
      W := D
      FW := +1
      If (FX = +1) {
         FX := -1
      } Else {
         FX := 0
      }
   }
   X += (D * FX)
   GuiControl, Move ,GUI2_TX, % "x" X "y" TXY "h" TXH "w" W
}
ExitApp

; Let's go
GUI2_Close:
GUI2_Escape:
ExitApp


Why does this not run? Change Gui 2 to 1, and it runs like a party. I looked this over and over and don't understand why it gets lost please help me! :?

BoBo
  • Guests
  • Last active:
  • Joined: --

For windows other than the first, the window's number is used as a prefix for the special labels mentioned above; for example, 2GuiEscape and 2GuiClose would be the default labels for the second window

From the help. :?

Light
  • Guests
  • Last active:
  • Joined: --
Ah, thank you bobo. The only connection I can make to my code is

; Let's go
2GUI_Close:
2GUI_Escape:
ExitApp

But this does not fix it. Can you point me to where I am failing?

tonne
  • Members
  • 1654 posts
  • Last active: May 06 2014 06:22 PM
  • Joined: 06 Jun 2006
There is no _ in GuiClose (and 2GuiClose).

YMP
  • Members
  • 424 posts
  • Last active: Apr 05 2012 01:18 AM
  • Joined: 23 Dec 2006
#NoEnv 
SetBatchLines -1 
SetControlDelay 0 

; Put in the char you want 
STR := "###" 
LEN := StrLen(STR) 
; Increase/decrease for slower/faster 
SLP := 25 

; Create the Gui 
Gui, 2:+LabelGUI2_ 
Gui, 2:Margin, 20, 20 
Gui, 2:Font, s22 cWhite Bold, Arial 
Gui, 2:Add, Text, vGUI2_TX , %STR% 
GuiControlGet, TX, 2:Pos, GUI2_TX                            ; Changed.
GuiControl, 2:Move, GUI2_TX, % "x" TXX "y" TXY "h" TXH "w0"  ; Changed.
Gui, 2:Show, , % "  :)" 

; Let's roll 
D := (TXW + (StrLen(STR) - 1)) // StrLen(STR) 
X := TXX 
FX := 0 
W := 0 
FW := +1 
Loop { 
   Sleep, %SLP% 
   W += (D * FW) 
   If (W > TXW) { 
      W := TXW - D 
      FW := -1 
      If (FX = 0) { 
         X := TXX 
         FX := +1 
      } ELSE { 
         FX := 0 
      } 
   } 
   If (W < 0) { 
      W := D 
      FW := +1 
      If (FX = +1) { 
         FX := -1 
      } Else { 
         FX := 0 
      } 
   } 
   X += (D * FX) 
   GuiControl, 2:Move , GUI2_TX, % "x" X "y" TXY "h" TXH "w" W  ; Changed.
} 
ExitApp 

; Let's go 
GUI2_Close: 
GUI2_Escape: 
ExitApp 
You can also use Gui, 2:Default to avoid the need for the "2:" prefix above.