Sign in to follow this  
Followers 0
pcjunki

gui search in gui

6 posts in this topic

#1 ·  Posted (edited)

i have a gui with about 11 tabs, and on each tab there is about 30-40 buttons that do functions

each button is coded as...

$TabSheet1 = GUICtrlCreateTabItem("floor1")
$Button1 = GUICtrlCreateButton("pc1", 38, 61, 131, 25)

i want to create at the top right of the gui a search box, kinda like in windows7

so you can type in "pc1" and it will go to the correct tab, and automatically highlight/select the button on the gui

is this even possible?

edit

if i have to redo the code as following to make it easier, i can

$pc1 = GUICtrlCreateButton("pc1", 38, 61, 131, 25)
Edited by pcjunki

Share this post


Link to post
Share on other sites



You'd probably be better off with a combobox with all the possible controls you want to access. This way there's no mistyping of the text. Using a combobox also allows you to link the contents with a controlID so you can find it easier.


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 Gude
How 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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i think you are right in doing the combo box, and it will be easier in the future to maintain code, so i've started all over.

this is what i have now, but still not working....i'm at a stump here, and probally so easy

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("WOL", 695, 189, 194, 126)
$Tab1 = GUICtrlCreateTab(8, 16, 673, 137)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$TabSheet1 = GUICtrlCreateTabItem("floor1")
$combo1 = GUICtrlCreateCombo("", 10, 56, 193, 25)
GUICtrlSetData(-1, "PC1|PC2")
$button1 = GUICtrlCreateButton("wake up", 210, 56, 73, 57, 0)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Button1
$pc = GUICtrlRead ($combo1)
Call ($pc)


Func PC1($pc)
;~ WOL COMMAND WILL PROGRAM IN LATER
EndFunc
EndSwitch
WEnd

i think it's messing up on the

Case $Button1
$pc = GUICtrlRead ($combo1)
Call ($pc)
Edited by pcjunki

Share this post


Link to post
Share on other sites

You'd probably want to change it to this:

While 1
 $nMsg = GUIGetMsg()
 Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $button1
   $pc = GUICtrlRead($combo1)
   PC1($pc) ; pass the computer name to the function instead of making a function for each computer.
 EndSwitch
WEnd
Func PC1($pc)
;~ WOL COMMAND WILL PROGRAM IN LATER
EndFunc   ;==>PC1

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 Gude
How 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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

if i change pc1 to 021pc1 i get a error

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("WOL", 695, 189, 194, 126)
$Tab1 = GUICtrlCreateTab(8, 16, 673, 137)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$TabSheet1 = GUICtrlCreateTabItem("floor1")
$combo1 = GUICtrlCreateCombo("", 10, 56, 193, 25)
GUICtrlSetData(-1, "021pc1|PC2")
$button1 = GUICtrlCreateButton("wake up", 210, 56, 73, 57, 0)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit


Case $button1
$pc = GUICtrlRead($combo1)
021pc1($pc) ; pass the computer name to the function instead of making a function for each computer.



EndSwitch
WEnd


Func 021pc1($pc)
;~ WOL COMMAND WILL PROGRAM IN LATER
EndFunc ;==>021PC1
Edited by pcjunki

Share this post


Link to post
Share on other sites

Function names can't start with numbers, you'd have to use an underscore or a letter first.


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 Gude
How 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

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
Sign in to follow this  
Followers 0