Jump to content

Try to create a GUI with 2 child windows


crappy
 Share

Recommended Posts

Hello,

i try to create a gui, with a scrollable listview on the lower side and some controls on the upper side, but the upper part should be scrollable too.

Below you see it created with vbscript and html. Is it possible to create this without html, only with autoit gui's and controls ?

discogs_tagger.jpg

I tried it with child windows and createGUI with Style and exStyle, but only i get was chaotic gui with not nearly what i want to.

Any help is greatly appreciated !

 

Link to comment
Share on other sites

  • Moderators

crappy,

Welcome to the AutoIt forums. :)

Not too difficult - and even easier if you use my GUIScrollbars_Ex UDF (look in my sig for the link): ;)

#include <GUIConstantsEx.au3>
#include <GUIScrollBars_Ex.au3>

; Create main GUI
$hGUI = GUICreate("Test", 500, 500)

; Create ListView
$cLV = GUICtrlCreateListView("Column 0|Column 1", 0, 400, 500, 100)
For $i = 0 To 10
    GUICtrlCreateListViewItem("Item " & $i, $cLV)
Next

GUISetState()

; Now create the child GUI
$hGUI_Child = GUICreate("Child", 500, 400, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
For $i = 0 To 10
    GUICtrlCreateLabel("Item " & $i, 10, 0 + ($i * 50), 480, 30)
    GUICtrlSetBkColor(-1, 0xFFCCCC)
Next

GUISetState()

; Add teh scrollbars to the child - the parametr is the bottom of the final label added
_GUIScrollbars_Generate($hGUI_Child, 0, 530)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
please ask if you have any questions. :)

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

 

Link to comment
Share on other sites

  • Moderators

crappy,

Glad I could help. :)

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

 

Link to comment
Share on other sites

  • Moderators

crappy,

I can scroll both parts of the GUI using the mousewheel - did you click on the top (child) GUI to activate it? :huh:

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

 

Link to comment
Share on other sites

Yes, i click in the top GUI to activate it.

Now i know why it doesn't work. i put a ComboBox in the upper part, which always have the focus... >_<

After changing the TAB-Order the scrolling works :shifty:

Edited by crappy
Link to comment
Share on other sites

Hello,

 

if i start the script, i can use the mouse wheel to scroll. But if i click into a combobox, i can't get the focus out of this control, so the mouse wheel scroll through the combobox items. Clicking in the window doesn't make a sense. Do i something wrong ?

 

Here is the part with the gui :

#include-once
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiComboBox.au3>
#include <ListViewConstants.au3>
#include <GUIScrollBars_Ex.au3>
#include <EditConstants.au3>
#include <GuiRichEdit.au3>

_BuildForm()


Func _BuildForm()

    Local $iExWindowStyle = BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)

    Local $iExListViewStyle = BitOR($LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT)
;~  Local $iWindowsStyle = BitOR($LVS_EDITLABELS, $LVS_REPORT)

    $Form_Main = GUICreate("Discogs Tagger", @DesktopWidth - 10, @DesktopHeight - 65, 0, 0)

    $CreateListView = "#|CD|Title|Artist|Album|Producer|Composer"
    $ListView1 = _GUICtrlListView_Create($Form_Main, $CreateListView, 5, @DesktopHeight - 347, @DesktopWidth - 10, 250, $iExWindowStyle)
    _GUICtrlListView_SetExtendedListViewStyle($ListView1, $iExListViewStyle)
    $hLV = GUICtrlGetHandle($ListView1)

    For $i = 1 To 20
        _GUICtrlListView_AddItem($ListView1, "Item" & $i)
        _GUICtrlListView_AddSubItem($ListView1, $i-1, "Item1-" & $i, 1)
    Next


    $Button_up = GUICtrlCreateButton("Up", 20, @DesktopHeight - 90, 50, 20)
    $Button_Down = GUICtrlCreateButton("Down", 80, @DesktopHeight - 90, 50, 20)

    $Button_Update = GUICtrlCreateButton("Update", @DesktopWidth - 265, @DesktopHeight - 90, 75, 20)
    $Button_Skip = GUICtrlCreateButton("Skip", @DesktopWidth - 180, @DesktopHeight - 90, 75, 20)
    $Button_Cancel2 = GUICtrlCreateButton("Cancel", @DesktopWidth - 95, @DesktopHeight - 90, 75, 20)

    $StatusBox = GUICtrlCreateInput("Ready", 170, @DesktopHeight - 90, 250, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))

    GUISetState(@SW_SHOW)


    ; Now create the child GUI
    $Form = GUICreate("Child", @DesktopWidth - 10, @DesktopHeight - 348, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $Form_Main)


    $NewSearchButton = GUICtrlCreateButton("Search", @DesktopWidth - 270, 8, 120, 25)
    GUICtrlSetResizing(-1, 772)
    $OptionsButton = GUICtrlCreateButton("Options", @DesktopWidth - 140, 8, 120, 25)
    GUICtrlSetResizing(-1, 772)
    $Resultbox = _GUICtrlComboBox_Create($Form, "", 5, 8, @DesktopWidth - 300, 25)


    GUICtrlCreateLabel("Filter Results:", @DesktopWidth - 692, 40, 100, 20, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUICtrlCreateGraphic(@DesktopWidth - 695, 60, 680, 55)
    GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, 0, 680, 55)
    GUICtrlSetState(-1, $GUI_Disable)

    $QuickSearchBox = GUICtrlCreateCombo("", @DesktopWidth - 1042, 90, 265, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlCreateLabel("Quick Search:", @DesktopWidth - 1042, 70, 100, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

    $LoadBox = GUICtrlCreateCombo("", @DesktopWidth - 1181, 90, 129, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlCreateLabel("Load :", @DesktopWidth - 1181, 70, 47, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

    $SearchBox = GUICtrlCreateCombo("", @DesktopWidth - 1320, 90, 129, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Discogs|Musicbrainz", "Discogs")
    GUICtrlCreateLabel("Search Page :", @DesktopWidth - 1320, 70, 102, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

    GUICtrlCreateGraphic(Round(@DesktopWidth * 0.15, 0) , 128, Round(@DesktopWidth * 0.85, 0), 25)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0xABABAB)
    GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, 0, Round(@DesktopWidth * 0.85, 0), 25)

    GUICtrlCreateLabel("Release Information :", 250, 130, 151, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUICtrlSetBkColor(-1, 0xABABAB)
    GUICtrlCreateLabel("Tracklisting :", 600, 130, 93, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUICtrlSetBkColor(-1, 0xABABAB)
    $Pic1 = GUICtrlCreatePic("", 32, 168, 153, 153)
    $MoreImageButton = GUICtrlCreateButton("More Images", 40, 268, 145, 25)
    $SaveImageCheckBox = GUICtrlCreateCheckbox("Save Cover", 40, 236, 137, 25)
    $SaveOptionsButton = GUICtrlCreateButton("Save Options", 40, 324, 145, 25)

    $LyricistCheckBox = GUICtrlCreateCheckbox("Save Lyricist", 20, 400, 129, 15)
    $ComposerCheckBox = GUICtrlCreateCheckbox("Save Composer", 20, 420, 113, 15)
    $ConductorCheckBox = GUICtrlCreateCheckbox("Save Conductor", 20, 440)
    $ProducerCheckBox = GUICtrlCreateCheckbox("Save Producer", 20, 460)
    $InvolvedCheckBox = GUICtrlCreateCheckbox("Save Involved People", 20, 480)
    $CommentsCheckBox = GUICtrlCreateCheckbox("Save Comment", 20, 500)
    $UseanvCheckBox = GUICtrlCreateCheckbox("Don't Use ANV's", 20, 520)
    GUICtrlSetTip(-1, "Artist Name Variation - Using no name variation (e.g. nickname)")
    $YearonlydateCheckBox = GUICtrlCreateCheckbox("Only Year Of Date", 20, 540)
    GUICtrlSetTip(-1, "If checked only the Year will be saved (e.g. 14.01.1982 -> 1982)")
    $titlefeaturingCheckBox = GUICtrlCreateCheckbox("feat. Artist behind Title", 20, 560)
    GUICtrlSetTip(-1, "If checked the feat. Artist appears in the title tag (e.g. Aaliyah (ft. Timbaland) - We Need a Resolution  ->  Aaliyah - We Need a Resolution (ft. Timbaland) )")
    $FeaturingNameCheckBox = GUICtrlCreateCheckbox("Rename 'feat.' to:", 20, 580)
    GUICtrlSetTip(-1, "Rename 'feat.' to the given word")
    $TxtFeaturingNameText = GUICtrlCreateInput("", 20, 600, 100, 20)
    $variousCheckBox = GUICtrlCreateCheckbox("Rename 'Various' Artist to:", 20, 630)
    GUICtrlSetTip(-1, "Rename 'Various' Artist to the given word")
    $TxtvariousText = GUICtrlCreateInput("", 20, 650, 100, 20)
    $InvolvedpeoplesingleCheckBox = GUICtrlCreateCheckbox("Invol. people on individual lines", 20, 680)
    GUICtrlSetTip(-1, "Print every involved people on individual lines")

    GUICtrlCreateLabel("Disc/Track Numbering:", 25, 720, 140, 20)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

    $TurnOffSubTrackCheckBox = GUICtrlCreateCheckbox("No Sub-Track detection", 20, 740)
    GUICtrlSetTip(-1, "If checked the Sub-Track detection is turned off")
    $SubTrackNameSelectionCheckBox = GUICtrlCreateCheckbox("Other Sub-Track Naming", 20, 760)
    GUICtrlSetTip(-1, "If checked the Sub-Track will be named like 'Sub-Track 1, Sub-Track 2, Sub Track 3'  if not checked the Sub-Tracks will be named like 'Track Name (Sub-Track 1, Sub-Track 2, Sub Track 3)'")
    $forcenumericCheckBox = GUICtrlCreateCheckbox("Force To Numeric", 20, 780)
    GUICtrlSetTip(-1, "Always use numbers instead of letters (Vinyl-releases use A1, A2,..., B1, B2 as track numbering)")
    $sidestodiscCheckBox = GUICtrlCreateCheckbox("Sides To Disc", 20, 800)
    GUICtrlSetTip(-1, "Save the Vinyl sides to the disc tag")
    $forcediscCheckBox = GUICtrlCreateCheckbox("Force Disc Usage", 20, 820)
    GUICtrlSetTip(-1, "Always add a disc-number")
    $nodiscCheckBox = GUICtrlCreateCheckbox("Force NO Disc Usage", 20, 840)
    GUICtrlSetTip(-1, "Prevent the script from interpret sub tracks as disc-numbers")
    $leadingzeroCheckBox = GUICtrlCreateCheckbox("Add Leading Zero", 20, 860)
    GUICtrlSetTip(-1, "Track Position: 1 -> 01   2 -> 02 ...")

    $ReleaseCheckBox = GUICtrlCreateCheckbox("Release:", 250, 190, 151, 20)
    $ArtistCheckBox = GUICtrlCreateCheckbox("Artist:", 250, 215, 151, 20)
    $AlbumCheckBox = GUICtrlCreateCheckbox("Album:", 250, 240, 151, 20)
    $AlbumArtistCheckBox = GUICtrlCreateCheckbox("Album Artist:", 250, 265, 90, 20)
    $AlbumArtistCheckBoxText = GUICtrlCreateLabel("", 350, 270, 100, 20)
    $LabelCheckBox = GUICtrlCreateCheckbox("Label:", 250, 290, 90, 20)
    $LabelCheckBoxText = GUICtrlCreateLabel("", 350, 295, 100, 20)
    $CatalogCheckBox = GUICtrlCreateCheckbox("Catalog#:", 250, 315, 151, 20)
    $FormatCheckBox = GUICtrlCreateCheckbox("Format:", 250, 340, 151, 20)
    $CountryCheckBox = GUICtrlCreateCheckbox("Country:", 250, 365, 151, 20)
    $DateCheckBox = GUICtrlCreateCheckbox("Date:", 250, 390, 151, 20)
    $OrigDateCheckBox = GUICtrlCreateCheckbox("Original Date:", 250, 415, 90, 20)
    $OrigDateCheckBoxText = GUICtrlCreateLabel("", 350, 415, 100, 20)
    $GenreCheckBox = GUICtrlCreateCheckbox("", 250, 440, 20, 20)
    $StyleCheckBox = GUICtrlCreateCheckbox("", 270, 440, 20, 20)

    $hRichEdit = _GUICtrlRichEdit_Create($Form, "", 290, 440, 151, 20)

    $DataQualityCheckBox = GUICtrlCreateLabel("Release Data Quality:", 250, 465, 180, 20)

    $CheckAllCheckBox = GUICtrlCreateCheckbox("", 630, 160, 20, 20)
    $CheckCDCheckBox = GUICtrlCreateCheckbox("", 660, 160, 20, 20)
    $CheckTrackCheckBox = GUICtrlCreateCheckbox("", 690, 160, 20, 20)

    #EndRegion ### END Koda GUI section ###


    GUISetState()

    ; Add teh scrollbars to the child - the parametr is the bottom of the final label added
    _GUIScrollbars_Generate($Form, 0, 880)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                If IsObj($hRichEdit) Then _GUICtrlRichEdit_Destroy($hRichEdit) ; wird benötigt, da sonst das Skript abstürzt
                Exit

        EndSwitch
    WEnd

EndFunc
Edited by Melba23
Repaired formatting
Link to comment
Share on other sites

  • Moderators

crappy,

You need to return the keyboard focus to a non-scrollable control in the upper GUI once you have finished with any of the other controls which steal the scroll. What I suggest is adding a line at the end of each of the Case statements for these controls like this:

Case $SearchBox ; This is a combo and so will steal the scroll when it has focus
    ; Code to deal with the combo selection
    GUICtrlSetState($SaveOptionsButton, $GUI_FOCUS) ; Pass focus to a non-scrollable control - here a button
All clear? :)

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...