tommytx Posted April 8, 2012 Posted April 8, 2012 (edited) I searched for erase commands but they all seemed to be related to erasing the entire GUI. Is it possible to erase the object and replace it? On my function calls i only show one button, however there would be many controls on each page when the final product is done. I only show one control button on each page just for simplification. I assume that once I know how to erase the object and replace it with another it will apply no matte how many controls the object applies to.. also is there a better objec to attach to other than $oIE since I really don't need to access the web, just files and buttons on my local computer... Thanks.. At this point when I select any drop down menu item it goes to the same "Close" option. I assume that is because all my options use the same object... so that is why I want to build and erase objects at menu selection.... or is there a much simpler way to do this... AutoIt expandcollapse popup#include <IE.au3> #include <GuiMenu.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $oIE, $obj, $test, $hGeneral, $hOther, $hMain Global $idClose, $idMinimize, $idActivate, $idExit ; Global Enum $idClose = 1000, $idMinimize HotKeySet("{ESC}", 'Terminate') _Main() GUISetState() ;Show GUI While 1 GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") WEnd Func Close() ; Erase the obj then write the new one ???? $obj = GUICtrlCreateObj ($oIE, 10, 40, 600, 360) $test = GUICtrlCreateButton("Close",20,20,100,20) GUISetState() ;Show GUI EndFunc Func Minimize() ; Erase the obj then write the new one ???? $obj = GUICtrlCreateObj ($oIE, 10, 40, 600, 360) $test = GUICtrlCreateButton("Minimize",20,20,100,20) GUISetState() ;Show GUI EndFunc Func Activate() ; Erase the obj then write the new one ???? $obj = GUICtrlCreateObj ($oIE, 10, 40, 600, 360) $test = GUICtrlCreateButton("Activate",20,20,100,20) GUISetState() ;Show GUI EndFunc Func _Main() Local $hGUI, $hGeneral, $hOther ; Create GUI $hGUI = GUICreate("Menu", 400, 300) ; Create menu 1 $hGeneral = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hGeneral, 0, "&Close", $idClose) _GUICtrlMenu_InsertMenuItem ($hGeneral, 1, "&Minimize", $idMinimize) _GUICtrlMenu_InsertMenuItem ($hGeneral, 2, "&Exit", $idExit) ; Create menu 2 $hOther = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hOther, 0, "&Activate", $idActivate) ; Create Main menu $hMain = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hMain, 0, "&General", 0, $hGeneral) _GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Other", 0, $hOther) ; Set window menu _GUICtrlMenu_SetMenu ($hGUI, $hMain) EndFunc ; Handle menu commands Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Switch _WinAPI_LoWord ($iwParam) Case $idClose Close() Case $idMinimize Minimize() Case $idActivate Activate() Case $idExit Terminate() EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func Terminate() Exit EndFunc AutoIt Edited April 8, 2012 by tommytx
tommytx Posted April 10, 2012 Author Posted April 10, 2012 anyone have any thoughts or ideas for this.. I cannot move my project forward until i find a solution for this.. or another way to do it...'
BrewManNH Posted April 10, 2012 Posted April 10, 2012 Seems like an overly complicated way to add a button to a GUI, but you should probably be looking at GUICtrlDelete. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
tommytx Posted April 10, 2012 Author Posted April 10, 2012 Its not a button I want to delete, I simply want to update the 16 checkboxes.. when i look at that Tab.. you see the checkboxes appear only when a window is in existence and they come and go.. so at the very least I want to be able to erase and reprint the checkboxes depending in the windows status at any time.. But GuiCtrlDelete sounds like a possibility since all 16 check boxes are controls... will let you know if it works.. Thanks for the suggestion.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now