Jump to content
Yolowbeard

Second gui demolishes buttons from the first gui

Recommended Posts

Hello, I am new here. I've started my adventure with AutoIt about a month ago. I am NOT a hacker or cheater and everything I do with AutoIt is meant to help me at work.

 

On topic:

I've created a macro managing program, this program has two gui's, the first one is a general one, where I can set up multiple clicks or open a window that allows me to allocate hotkeys, which, for example, set up an "if" condition I usually use, a loop, function and other stuff I use on a daily basis. The macro button is the issue, because I made it to open a new window (gui) that allows me to set up a button, and when this particular window opens, the first gui loses help button (is grayed) and, in some cases, two other buttons sometimes pick up values of the second gui, and say "No hotkey" instead of "Attach hotkey" and "Normalize mouse clicks".

This is how it's supposed to look:

SZQG44b.png

 

This is how it looks after the new gui appears:

 

e04xMHr.png

 

You see the "?" button is grayed now. Nothing else changed because I was lucky or something, and if I close the second gui, nothing changes in the first one. This is still work in progress, so it sure looks ugly. I "solved" that by deleting the first gui after the second is created, and then create the first one after deleting the second, but it doesn't have a pretty good effect. Is there any way to fix this?

 

PS: all buttons have different variables assigned to them. I checked 5 times to make sure I didn't F up anything. 

Share this post


Link to post
Share on other sites

Yolowbeard,

I suggest posting your code - see here how to do it.  Then we might get an idea as to why this is happening.

M23

 


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Func MacroManagerGui()

    ;Opt("GUICoordMode", 2)
    ;Opt("GUIResizeMode", 1);those two change something with button scaling
    Opt("GUIOnEventMode", 1)
    Opt("GUICloseOnESC", 0)
    Global $Gui_ = GUICreate("Macro manager", 260, 75);, 1325, 760)
    GUICtrlCreatePic("PirateShip.jpg", -1, -1, 260, 75)
    GUICtrlSetState(-1, 128);allows the buttons to be pressed as fuck
    GUISetIcon("Randomicon.ico")
    Global $Hkey_ = GUICtrlCreateButton("Attach hotkey", 10, 10);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($Hkey_, "ButtonAttachmentGUI");"AssignNewHotkey")
    Global $ClickAcceleration = GUICtrlCreateButton("Accelerate clicking rate", 135, 10);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($ClickAcceleration, "AccelerateMouseClicks")
    Global $disableScript = GUICtrlCreateButton("Toggle the script", 10, 40);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($disableScript, "EnableDisableHotkeys")
    Global $clickNormalization = GUICtrlCreateButton("Normalize mouse clicks", 135, 40);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($clickNormalization, "NormalizeClicks")
    Global $oythor = GUICtrlCreateButton("Author", 92, 10);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($oythor, "Oythor")
    Global $helpOfDoom = GUICtrlCreateButton(" ? ", 106, 40);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($helpOfDoom, "HelpAsFuck")
    GUISetState(@SW_SHOW, $Gui_)

    GUISetOnEvent($GUI_EVENT_CLOSE, "KillTheProgram")
    ;GUISetOnEvent($GUI_EVENT_MINIMIZE, "KillTheProgram")
    ;GUISetOnEvent($GUI_EVENT_RESTORE, "KillTheProgram")

EndFunc

Second Gui:

Func ButtonAttachmentGUI()

    ;Opt("GUICoordMode", 2)
    ;Opt("GUIResizeMode", 802);those two change something with button scaling
    ;Opt("GUIOnEventMode", 1)
    Opt("GUICloseOnESC", 0)
    Global $BAGui_ = GUICreate("Hotkey Assignment", 55, 190, -1, -1, 0x00040000);, 1325, 760)
    ;GUICtrlSetResizing($BAGui_, 802)
    ;GUICtrlCreatePic("PirateShip.jpg", -1, -1, 260, 75)
    GUICtrlSetState(-1, 128);allows the buttons to be pressed as fuck
    GUISetIcon("Randomicon.ico")
    Global $Hkey1_ = GUICtrlCreateButton("SET NUMPAD 999", 8, 10);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($Hkey1_, "HotkeyAssignment1")
    Global $Hkey2_ = GUICtrlCreateButton("SET NUMPAD 999", 8, 40);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($Hkey2_, "HotkeyAssignment2")
    Global $Hkey3_ = GUICtrlCreateButton("SET NUMPAD 999", 8, 70);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($Hkey3_, "HotkeyAssignment3")
    Global $Hkey4_ = GUICtrlCreateButton("SET NUMPAD 999", 8, 100);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($Hkey4_, "HotkeyAssignment4")
    Global $Hkey5_ = GUICtrlCreateButton("SET NUMPAD 999", 8, 130);, StringLen("Increase clicking rate")*10)
    GUICtrlSetOnEvent($Hkey5_, "HotkeyAssignment5")
    GUISetState(@SW_SHOW, $BAGui_)

    GUIDelete($Gui_)
    Call("CheckHKeyAvailability", $Hkey1_, 1)
    Call("CheckHKeyAvailability", $Hkey2_, 4)
    Call("CheckHKeyAvailability", $Hkey3_, 7)
    Call("CheckHKeyAvailability", $Hkey4_, 10)
    Call("CheckHKeyAvailability", $Hkey5_, 13)

    GUISetOnEvent($GUI_EVENT_CLOSE, "CloseHKeyGui")
    ;GUISetOnEvent($GUI_EVENT_MINIMIZE, "KillTheProgram")
    ;GUISetOnEvent($GUI_EVENT_RESTORE, "KillTheProgram")

    ;Const $GWL_STYLE = -16
    ;Const $WS_SIZEBOX = 262144

    Local $hWnd = WinGetHandle("Hotkey Assignment")
    Local $style = _WinAPI_GetWindowLong($hWnd, -16)
    If BitXOR($style,262144) <> BitOr($style,BitXOR($style,262144)) Then _WinAPI_SetWindowLong($hWnd,-16,BitXOR($style,262144))

EndFunc

Func CloseHKeyGui()
    GUIDelete($BAGui_)
    Call("MacroManagerGUI")
EndFunc

 

Share this post


Link to post
Share on other sites

I accidentally pasted the version with the deletion of gui and re-creation. Just ignore the GUIDelete($Gui_) and Call("MacroManagerGUI") - these are added to remove and create back the first gui so everything works fine. Also, I don't know how to edit posts, so sorry about it.

Share this post


Link to post
Share on other sites
Posted (edited)

Yolowbeard,

Posting 2 functions does not help much, we need to see the whole thing so the interactions between the various sections are clear.

And looking at the code, you might want to read the Forum rules before you post again - particularly the bit about not discussing game automation. At the moment I am happy for the thread to remain open as the problem is one of GUI interaction, but please be careful about what you post in future.

M23

 

Edited by Melba23
Wrong key too soon!

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...