linking Credits to main GUI Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
shadad
Posts: 32
Joined: 23 Jun 2018, 05:21

linking Credits to main GUI

22 Jul 2018, 23:48

Hi there :D

I am about to finalize my full application soon and need small help linking a credit button to it. I want to be able attach my Credits script to the main application GUI so when the user press on the credit button it open up then it close and return to the main GUI.

i manage to customize both but when ever i tried to link it, its not showing correctly and cause miss interface. this is the main app GUI:

Code: Select all

Gui, Add, Button, x310 y32 w130 h30 gSettings, Credit
Gui, Show, x450 y163 h380 w460 , Application ABC
return

Settings:
;here i want to put my Credits infos windpow script


return
GuiEscape:
GuiClose:
   ExitApp

and here is my Credits info script:

Code: Select all

WinH = 80            ; Height of GUI
YPos1 := WinH  - 10  ; Bottom of GUI Window
YPos2 := YPos1 + 20  ; 60 pixels gap
YPos3 := YPos2 + 10
YPos4 := YPos3 + 0

TestText =
(LTrim
   Producer: 
   Programmer: 
   AssistantProducer: Yes..only me :D
   
  
   BYE
   
)

Gui +ToolWindow +AlwaysOnTop
Gui Margin, 0, 0

Gui Add, Picture, vIcon1 x12 y%YPos1% h16 w16 Icon44, shell32.dll
Gui Add, Text,    vText1 x30, Special thanks to:
Gui Add, Text,    vText4 x5  y%YPos1%, %TestText%
Gui Show, w189 h%WinH%, Credits:

Loop
{
   YPos1--
   GuiControl Move, Icon1, y%YPos1%
   GuiControl Move, Text1, y%YPos1%
   YPos2--
   GuiControl Move, Icon2, y%YPos2%
   GuiControl Move, Text2, y%YPos2%
   YPos3--
   GuiControl Move, Icon3, y%YPos3%
   GuiControl Move, Text3, y%YPos3%
   YPos4--
   GuiControl Move, Text4, y%YPos4%
   GuiControlGet Text4, Pos
   If (text4Y + text4H < WinH)
      Break
   Sleep 60
}
Sleep 5000

GuiEscape:
GuiClose:
   ExitApp
   

any advice ? :think:
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: linking Credits to main GUI

23 Jul 2018, 02:06

Your credits GUI should use a different gui name (gui, 2:) (update this for all your guicontrols too).

The code added to the loop to break is the only way I know that will allow for a gui destroy and then have the button work again if you exit the second gui before the loop breaks. If anyone knows another method please share.



example

Code: Select all

Gui, Add, Button, x310 y32 w130 h30 gSettings, Credit
Gui, Add, Button, x310 y72 w130 h30 gSettings, Credit2
Gui, Show, x450 y163 h380 w460 , Application ABC
return

Settings:
exgui =
WinH = 80            ; Height of GUI
YPos1 := WinH  - 10  ; Bottom of GUI Window
YPos2 := YPos1 + 20  ; 60 pixels gap
YPos3 := YPos2 + 10
YPos4 := YPos3 + 0
TestText =
(LTrim
   Producer: 
   Programmer: 
   AssistantProducer: Yes..only me :D
   AHK Community ;  :bravo:  :lol: 
   
  
   BYE
   
)

Gui 2: +ToolWindow +AlwaysOnTop
Gui 2: Margin, 0, 0

Gui 2: Add, Picture, vIcon1 x12 y%YPos1% h16 w16 Icon44, shell32.dll
Gui 2: Add, Text,    vText1 x30, Special thanks to:
Gui 2: Add, Text,    vText4 x5  y%YPos1%, %TestText%
Gui 2: Show, w189 h%WinH%, Credits:

Loop
{
   YPos1--
   GuiControl 2: Move, Icon1, y%YPos1%
   GuiControl 2: Move, Text1, y%YPos1%
   YPos2--
   GuiControl 2:Move, Icon2, y%YPos2%
   GuiControl 2:Move, Text2, y%YPos2%
   YPos3--
   GuiControl 2: Move, Icon3, y%YPos3%
   GuiControl 2: Move, Text3, y%YPos3%
   YPos4--
   GuiControl 2: Move, Text4, y%YPos4%
   GuiControlGet, Text4, 2: Pos
   If (text4Y + text4H < WinH)
      Break
   if (exgui = 1)
      break
   Sleep 60
}

return
GuiEscape:
GuiClose:
ExitApp

2GuiEscape:
2GuiClose:
exgui = 1
Gui, 2: Destroy
return
shadad
Posts: 32
Joined: 23 Jun 2018, 05:21

Re: linking Credits to main GUI

23 Jul 2018, 04:06

AHKStudent wrote:Your credits GUI should use a different gui name (gui, 2:) (update this for all your guicontrols too).

The code added to the loop to break is the only way I know that will allow for a gui destroy and then have the button work again if you exit the second gui before the loop breaks. If anyone knows another method please share.



example

Code: Select all

Gui, Add, Button, x310 y32 w130 h30 gSettings, Credit
Gui, Add, Button, x310 y72 w130 h30 gSettings, Credit2
Gui, Show, x450 y163 h380 w460 , Application ABC
return

Settings:
exgui =
WinH = 80            ; Height of GUI
YPos1 := WinH  - 10  ; Bottom of GUI Window
YPos2 := YPos1 + 20  ; 60 pixels gap
YPos3 := YPos2 + 10
YPos4 := YPos3 + 0
TestText =
(LTrim
   Producer: 
   Programmer: 
   AssistantProducer: Yes..only me :D
   AHK Community ;  :bravo:  :lol: 
   
  
   BYE
   
)

Gui 2: +ToolWindow +AlwaysOnTop
Gui 2: Margin, 0, 0

Gui 2: Add, Picture, vIcon1 x12 y%YPos1% h16 w16 Icon44, shell32.dll
Gui 2: Add, Text,    vText1 x30, Special thanks to:
Gui 2: Add, Text,    vText4 x5  y%YPos1%, %TestText%
Gui 2: Show, w189 h%WinH%, Credits:

Loop
{
   YPos1--
   GuiControl 2: Move, Icon1, y%YPos1%
   GuiControl 2: Move, Text1, y%YPos1%
   YPos2--
   GuiControl 2:Move, Icon2, y%YPos2%
   GuiControl 2:Move, Text2, y%YPos2%
   YPos3--
   GuiControl 2: Move, Icon3, y%YPos3%
   GuiControl 2: Move, Text3, y%YPos3%
   YPos4--
   GuiControl 2: Move, Text4, y%YPos4%
   GuiControlGet, Text4, 2: Pos
   If (text4Y + text4H < WinH)
      Break
   if (exgui = 1)
      break
   Sleep 60
}

return
GuiEscape:
GuiClose:
ExitApp

2GuiEscape:
2GuiClose:
exgui = 1
Gui, 2: Destroy
return
Thanks for pointing to that. but whenever i close the Credit window and try to open it again from the main GUI its not responding. its like working only one time. can you help?

sorry to bother you
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: linking Credits to main GUI  Topic is solved

23 Jul 2018, 05:15

did you copy the entire code I posted?

If you did it should work.
shadad
Posts: 32
Joined: 23 Jun 2018, 05:21

Re: linking Credits to main GUI

23 Jul 2018, 05:36

AHKStudent wrote:did you copy the entire code I posted?

If you did it should work.
I.....I don't know what happened! :? :shock:

Am sure i copied your script twice and tried it today. when i just copied it now i found it contain more changes and 2 new buttons. I guess am getting old. anyway, i tried the Code you prepared, Its Working perfect!

thank you you soo much and sorry for the inconvenience :oops:
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: linking Credits to main GUI

23 Jul 2018, 07:14

shadad wrote:
AHKStudent wrote:did you copy the entire code I posted?

If you did it should work.
I.....I don't know what happened! :? :shock:

Am sure i copied your script twice and tried it today. when i just copied it now i found it contain more changes and 2 new buttons. I guess am getting old. anyway, i tried the Code you prepared, Its Working perfect!

thank you you soo much and sorry for the inconvenience :oops:
sorry, I did update my script after I posted it the first time but it was pretty close to my post so thought you didn't see the first one. It doesn't mean you are not getting older, we all are :thumbup:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 249 guests