Jump to content
Sign in to follow this  
JuanFelipe

GUICtrlCreateButton

Recommended Posts

Hi friends, I need help with the process, I have a button to initiate a code but do not know how to configure it to be the button to start the process, thank you very much for your help.

Here I leave the code to see if I have to change some part.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\juan.caballeron\desktop\ \programacion\autoit\capturas\koda_1.7.3.0\forms\grabar capturas.kxf
$Form1_1 = GUICreate("WhiteSnake", 655, 487, 192, 124)
GUISetIcon("C:\Users\juan.caballeron\Desktop\ \Programacion\Autoit\Capturas\koda_1.7.3.0\iconos\Avatar on ice-256.ico", -1)
GUISetBkColor(0xC8C8C8)
$hechos = GUICtrlCreateGroup("Hechos", 16, 32, 385, 169)
GUICtrlSetColor(-1, 0x000000)
$box_fechah = GUICtrlCreateInput("", 112, 72, 81, 21)
GUICtrlSetLimit(-1, 10)
$box_hora = GUICtrlCreateInput("", 112, 104, 81, 21)
GUICtrlSetLimit(-1, 5)
$box_fechaf = GUICtrlCreateInput("", 112, 136, 81, 21)
GUICtrlSetLimit(-1, 10)
$box_fte = GUICtrlCreateInput("", 112, 168, 81, 21)
GUICtrlSetLimit(-1, 5)
$Label3 = GUICtrlCreateLabel("Fecha Hecho:", 24, 72, 72, 17)
$Label4 = GUICtrlCreateLabel("Hora:", 24, 104, 30, 17)
$Label5 = GUICtrlCreateLabel("Fecha Fuente:", 24, 136, 73, 17)
$Label6 = GUICtrlCreateLabel("Nro. Fuente:", 24, 168, 63, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$personas = GUICtrlCreateGroup("Datos de la Persona", 16, 224, 585, 185)
$Label1 = GUICtrlCreateLabel("Tipo Identificación:", 32, 256, 94, 17)
$Label2 = GUICtrlCreateLabel("No. Documento:", 32, 280, 82, 17)
$Label7 = GUICtrlCreateLabel("Apellidos", 32, 304, 46, 17)
$Label8 = GUICtrlCreateLabel("Nombres", 32, 328, 46, 17)
$Label9 = GUICtrlCreateLabel("Sexo", 32, 352, 28, 17)
$Label10 = GUICtrlCreateLabel("Fecha Nacimiento", 32, 376, 90, 17)
$Combo1 = GUICtrlCreateCombo("Selección", 128, 256, 193, 21)
$Combo1 = GUICtrlSetData(-1, "Tarjeta de Identidad|Cédula")
GUICtrlSetLimit(-1, 1)
$documento = GUICtrlCreateInput("", 128, 280, 193, 21)
$apellidos = GUICtrlCreateInput("", 128, 304, 377, 21)
$nombres = GUICtrlCreateInput("", 128, 328, 377, 21)
$Combo2 = GUICtrlCreateCombo("Selección", 128, 352, 121, 21)
$Combo2 = GUICtrlSetData(-1, "Masculino|Femenino")
GUICtrlSetLimit(-1, 1)
$fecha_naci = GUICtrlCreateInput("", 128, 376, 121, 21)
GUICtrlSetLimit(-1, 10)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$datoscap = GUICtrlCreateGroup("Datos Capturas", 456, 32, 145, 169)
$Label11 = GUICtrlCreateLabel("Label11", 472, 56, 42, 17)
$Label12 = GUICtrlCreateLabel("Label12", 472, 80, 42, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Titulo = GUICtrlCreateLabel("PROCESO PARA GRABAR CAPTURAS EN EL SIEDCO.", 175, 8, 277, 17, $SS_CENTER)
GUICtrlSetCursor (-1, 3)
$Progress1 = GUICtrlCreateProgress(448, 432, 169, 9)
GUICtrlSetCursor (-1, 15)
$creador = GUICtrlCreateLabel("By WhiteSnake", 8, 440, 78, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Icon1 = GUICtrlCreateIcon("C:\Users\juan.caballeron\Desktop\ \Programacion\Autoit\Capturas\koda_1.7.3.0\iconos\1249549841170809086.ico", -1, 88, 432, 32, 32)
$iniciar = GUICtrlCreateButton("INICIAR PROCESO", 296, 424, 145, 25)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
 WEnd

 

I just need to know how to do that when you click the $iniciar start any process.

Edited by Jos
Put script in Codebox. Please use that the next time you post code.

Share this post


Link to post
Share on other sites
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case  $iniciar
            ;  Put what ever you want to do after pushing the button here
    EndSwitch
 WEnd

 


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  

  • Similar Content

    • By GillesMaisonneuve
      Good morning,
       
      I am trying to align a two-line text in a button so that it would be centered in the button but can't succeed to do it for the vertical part.
      Can someone tell me what I do wrong ?
      Here is my code:
      $btn3 = GUICtrlCreateButton("Execute " & @LF & " file 1", 100, 65, 60, 50, _ BitOr($BS_CENTER,$BS_BOTTOM,$BS_MULTILINE)) and here is the resulting layout I get in my window.
      I tried to follow the help, made a lot of different parameter combinations (here it's `$BS_BOTTOM`, but I tried `$BS_VCENTER` and `$BS_TOP`), still get the same result : vertical alignement is a no go for me.
      Can someone help ?
      TIA
      Gilles

    • By Pike
      Hey Everyone, I haven't been here in a while and recently picked up my old project. Still an FNG!
      To the point: I want to be able to push the button and either play an mp3, open a file, or open an exe program (all with the same button). The problem is that I don't know how to code for that at "case 1"
              Case 1                                                                                                                                             
                  Local $sRead = IniRead("config.ini", "Config", "One", "Default")                                
                  SoundPlay($sRead, @HotKeyPressed)                                                                     <-------------------------------
                  Run($sRead, @HotKeyPressed)                                                                                 <------------------------------- This 'Run' doesn't work even by itself!
      See code below for layout. If you need more information I will attach more code or answer any questions. Any help is greatly appreciated.
       
      Much Respect,
      Pike
       
      Func _HandleButton() $iClickCount += 1 $iTimer = TimerInit() AdlibRegister("CheckButtonPress", $CheckTime) EndFunc Func CheckButtonPress() If TimerDiff($iTimer) < $CheckTime Or $iTimer = 0 Then Return Switch $iClickCount Case 1 Local $sRead = IniRead("config.ini", "Config", "One", "Default") SoundPlay($sRead, @HotKeyPressed) Run($sRead, @HotKeyPressed) Case 2 MsgBox(0, "INFORMATION:", "Choose the file you want designated to this button") Local $sFileOpenDialog = FileOpenDialog(0, @ScriptDir & "\", "All (*.*)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") EndIf Local $sFileName = InputBox("INFORMATION:", "Please Name Your File?" & @CRLF _ & @CRLF _ & "6 Characters or Less", "") IniWrite(@ScriptDir & "\config.ini", "Config", "One", $sFileOpenDialog) IniWrite(@ScriptDir & "\config.ini", "Config", "NameOne", $sFileName) EndSwitch $iClickCount = 0 AdlibUnRegister() EndFunc  

    • By misioooo
      Hi!
       
      I am writing some GUI and i need to use images as buttons, but with text on them (text is from INI file).
      Part with button looks like this:
      $ankieta1 = GUICtrlCreateButton($txtAnk1, 100,350,765,164) GUICtrlSetFont(-1, 22, 800, -1, "Arial") ;GUICtrlSetColor(-1,0xffffff) $hImageBtn_1 = _GUIImageList_Create(765, 164) _GUIImageList_AddBitmap($hImageBtn_1, "c:\path\to\ankieta_clean.bmp") _GUICtrlButton_SetImageList($ankieta1, $hImageBtn_1, 4) GUICtrlSetOnEvent(-1, "On_Ankieta1") The problem - if i uncomment GUICtrlSetColor, color of text changes, but button is just plain gray (no image). How i can change text color not touching image on a button here?
    • By XinYoung
      Quick question: How can I click this "Select All" button in IE? There's no ID, and the href is "#"  
      Am I looking at the wrong html code?
      Am I looking
      Thank you all in advance!
    • By XinYoung
      Hello again 
      I need to click this Submit button, but it's in a lightbox and has no ID (i think) and I can't figure out a way to target it. _IEFormSubmit doesn't work.

       
      Thank you
×
×
  • Create New...