Jump to content
Sign in to follow this  
danpos2

Interacting with GUI controls

Recommended Posts

Hi, everyone ! I´ve started a GUI for to automatize some calculus using AutoBuilder (great job, Cyberslug!). Below the aspect of GUI:

Posted Image

Follows down the GUI code:

; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("DanMatic version 0.1 beta 1", 421, 484,(@DesktopWidth-421)/2, (@DesktopHeight-484)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

;Primeiro grupo de botões e outros gadgets - início

  $Group1 = GuiCtrlCreateGroup("Input / output", 10, 0, 390, 120)
$Label1_1 = GuiCtrlCreateLabel("Avisynth script", 10, 20, 70, 20)
$Input1_1 = GuiCtrlCreateInput("", 10, 40, 340, 20)
$Button_1 = GuiCtrlCreateButton("Browse", 350, 40, 40, 20)
$Label1_2 = GuiCtrlCreateLabel("Generated file extension", 10, 70, 120, 20)
$Input1_2 = GuiCtrlCreateInput(".mpv", 10, 90, 380, 20)

;Primeiro grupo de botões e outros gadgets - fim

;Segundo grupo de botões e outros gadgets - início

  $Group2 = GuiCtrlCreateGroup("Basic custom settings", 10, 130, 390, 200)
$Label2_1 = GuiCtrlCreateLabel("Matrix", 10, 150, 30, 20)
$Combo2_1 = GuiCtrlCreateCombo("BVCD", 10, 170, 140, 21)
$Label2_2 = GuiCtrlCreateLabel("Aspect ratio", 180, 150, 60, 20)
$Combo2_2 = GuiCtrlCreateCombo("4:3", 180, 170, 70, 21)
$Checkbox = GuiCtrlCreateCheckbox("Interlaced", 290, 170, 80, 30)
$Label2_3 = GuiCtrlCreateLabel("Target MPEG", 10, 200, 70, 20)
$Combo2_3 = GuiCtrlCreateCombo("MPEG-2", 10, 220, 140, 21)
$Label_20 = GuiCtrlCreateLabel("GOP", 180, 200, 30, 20)
$Input_8 = GuiCtrlCreateInput("18", 180, 220, 70, 20)
$Label_19 = GuiCtrlCreateLabel("VBV Size", 290, 200, 50, 20)
$Input_9 = GuiCtrlCreateInput("224", 290, 220, 70, 20)
$Label_22 = GuiCtrlCreateLabel("Target Size", 80, 250, 60, 20)
$Combo_24 = GuiCtrlCreateCombo("CD", 80, 270, 70, 21)
$Input_10 = GuiCtrlCreateInput("", 80, 300, 70, 20)
$Label_29 = GuiCtrlCreateLabel("MB", 160, 300, 20, 20)
$Label_25 = GuiCtrlCreateLabel("Audio bitrate", 180, 250, 60, 20)
$Combo_23 = GuiCtrlCreateCombo("112", 180, 270, 70, 21)
$Label_26 = GuiCtrlCreateLabel("Kbps", 260, 270, 30, 20)
$Input_11 = GuiCtrlCreateInput("", 180, 300, 70, 20)
$Label_27 = GuiCtrlCreateLabel("Kbps", 260, 300, 30, 20)
$Label_16 = GuiCtrlCreateLabel("Max bitrate", 290, 250, 60, 20)
$Input_12 = GuiCtrlCreateInput("8000", 290, 270, 70, 20)
$Label_28 = GuiCtrlCreateLabel("Kbps", 370, 270, 30, 20)

;Segundo grupo de botões e outros gadgets - fim

;Terceiro grupo de botões e outros gadgets - início

$Group_34 = GuiCtrlCreateGroup("Post processor", 10, 340, 390, 50)
$Radio_30 = GuiCtrlCreateRadio("None", 20, 360, 70, 20)
$Radio_31 = GuiCtrlCreateRadio("Close", 160, 360, 70, 20)
$Radio_32 = GuiCtrlCreateRadio("Shutdown", 290, 360, 70, 20)

;Terceiro grupo de botões e outros gadgets - início

 $Group_35 = GuiCtrlCreateGroup("Input / output", 10, 0, 390, 120)
$Button_38 = GuiCtrlCreateButton("Defaults", 20, 430, 110, 30)
$Button_37 = GuiCtrlCreateButton("Start", 150, 430, 110, 30)
$Button_36 = GuiCtrlCreateButton("About", 280, 430, 110, 30)

;Terceiro grupo de botões e outros gadgets - fim

; Loop que ativa a GUI e verifica os eventos nela ocorridos

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

I do plan read the data of each control (combo button, input box, etc) and then to create a .ini text file for further processing. Well, now the questions getting started:

1 - How does to assign one entry in .ini text file for a item in combo box button? For instance, if I've a .ini text file like this:

[HVS Good]8 16 16 16 17 18 21 24 16 16 16 16 17 19 22 25 16 16 17 18 20 22 25 29 16 16 18 21 24 27 31 36 17 17 20 24 30 35 41 47 18 19 22 27 35 44 54 65 21 22 25 31 41 54 70 88 24 25 29 26 47 65 88 115

20 20 20 20 21 23 26 30 20 20 20 20 22 24 27 32 20 20 21 22 24 27 31 36 20 20 22 26 30 34 38 44 21 22 24 30 37 44 51 59 23 24 27 34 44 56 68 81 26 27 31 38 51 68 88 109 30 32 36 44 59 81 109 144

[bVCD]

16 18 20 22 26 28 32 39 18 20 22 24 28 32 39 44 20 22 26 28 32 39 44 48 22 22 26 32 39 44 48 54 22 26 32 39 44 48 54 64 26 32 39 44 48 54 64 74 32 39 44 48 54 64 74 84 39 44 48 54 64 74 84 94

20 24 26 28 38 42 46 53 24 26 28 38 42 46 53 58 26 28 38 42 46 53 58 62 28 38 42 46 53 58 62 68 38 42 46 53 58 62 68 78 42 46 53 58 62 68 78 88 46 53 58 62 68 78 88 99 53 58 62 68 78 88 99 99

2 - How does to activate a input/edit button if one item in combo box button is chosen? For instance, if the item "Custom" is chosen in the combo box, it must to be active an specif input button.

3 - How does to open a locate to choose a specific extension file if the "Browse" button is pushed? Moreover, the file chosen must to be assigned to an input button specified (I want to say the FULL PATH to the file). How does to do that?

Sorry for bother with so newbies questions, but I didn't get to advance even after read a lot of documentation ... :)

Any help will be greatly appreciated !!

TIA,

Share this post


Link to post
Share on other sites

I can answer question 3:

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1;Browese
        $filename = FileOpenDialog("Choose a file...", "", "All (*.*)", 3);the 3 means file must exist
        If Not @error Then GuiCtrlSetData($Input1_1, $filename)
    Case Else
   ;;;
    EndSelect
WEnd
Exit

I don't understand question 1... Where are HVS and BVCD combo boxes?

Question 2: GENERAL EXAMPLE ...

#include <GuiConstants.au3>
GuiCreate("Example")

$combo = GuiCtrlCreateCombo("",10, 10, 100, 100)
GuiCtrlSetData($combo, "one|two|three", "one")

$One = GuiCtrlCreateButton("One", 10, 100, 200)
$Two = GuiCtrlCreateButton("Two", 10, 150, 200)
$Three = GuiCtrlCreateButton("three", 10, 200, 200)

GuiCtrlSetState($One, $GUI_ENABLE)
GuiCtrlSetState($Two, $GUI_DISABLE)
GuiCtrlSetState($Three, $GUI_DISABLE)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $combo
            Select
            Case GuiCtrlRead($combo) = "One"
                GuiCtrlSetState($One, $GUI_ENABLE)
                GuiCtrlSetState($Two, $GUI_DISABLE)
                GuiCtrlSetState($Three, $GUI_DISABLE)
            Case GuiCtrlRead($combo) = "Two"
                GuiCtrlSetState($One, $GUI_DISABLE)
                GuiCtrlSetState($Two, $GUI_ENABLE)
                GuiCtrlSetState($Three, $GUI_DISABLE)
            Case GuiCtrlRead($combo) = "Three"
                GuiCtrlSetState($One, $GUI_DISABLE)
                GuiCtrlSetState($Two, $GUI_DISABLE)
                GuiCtrlSetState($Three, $GUI_ENABLE)
            EndSelect
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    EndSelect
Wend

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

I don't understand question 1... Where are HVS and BVCD combo boxes?

First all, thank so much for your support !! :D You've appointed the direction that I must to go ahead.

With respect to my first question, now I see that I've misunderstood the stuffs ... I think that I must to define the entries in combo box (items) with "GuiCtrlSetData()" and then to play with each one; so, my first question must to be discarded. :D

[A little off-topic]: Autobuilder helps a lot the gui construction and I hope that you get some time for to do improvements on it (like "save/load" project feature, add other buttons, etc...). It's really a great piece of software! :) Keep up the good work! [end off-topic]

Cheers,

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...