Queener

Radio with combobox and items

3 posts in this topic

#1 ·  Posted (edited)

I know for a fact that the combobox and read ini sections name is correct and worked fine, but I'm not able to get it to display the information in combobox with a radio select.

So the goal is; if I select a radio 1 then it populate a list of items. As soon as I select the new radio then it populate another set of different items. How do I go about doing that? I tried:

 

 

If GUICtrlRead($itemlist1, $GUI_CHECKED) Then
    For $i = 1 To $sections1[0]
        $newvalue = $newvalue & $sections1[$i] & "|"
    Next
    GUICtrlSetData($inputinvitems, StringTrimRight($newvalue, 1))
    GUICtrlSetData($inputcreitems, StringTrimRight($newvalue, 1))

ElseIf GUICtrlRead($itemlist2, $GUI_CHECKED) Then
    For $i = 1 To $sections1[0]
        $newvalue = $newvalue & $sections1[$i] & "|"
    Next
    GUICtrlSetData($inputinvitems, StringTrimRight($newvalue, 1))
    GUICtrlSetData($inputcreitems, StringTrimRight($newvalue, 1))

 

I also tried if guictrlread combobox = 1 then. My guess would be that I would need a button to control the information being display?

Edited by Queener

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

Share this post


Link to post
Share on other sites



Queener,

I would do something like this:

#include <GUIConstantsEx.au3>

Global $aData[10] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

$hGUI = GUICreate("Test", 500, 500)

GUIStartGroup()
 $cRad_1 = GUICtrlCreateRadio(" Items 1-4", 10, 10, 200, 20)
 $cRad_2 = GUICtrlCreateRadio(" Items 5-9", 10, 50, 200, 20)

 $cCombo = GUICtrlCreateCombo("", 10, 100, 200, 20)

GUISetState()

While 1

    Local $iStart = -1, $iEnd = -1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cRad_1, $cRad_2
            $sData = ""
            If GUICtrlRead($cRad_1) = $GUI_CHECKED Then
                $iStart = 0
                $iEnd = 4
            Else
                $iStart = 5
                $iEnd = 9
            EndIf
            For $i = $iStart To $iEnd
                $sData &= "|" & $aData[$i]
            Next
            GUICtrlSetData($cCombo, $sData)

    EndSwitch

WEnd

Please ask if you have any questions.

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

when I use your example it works, but if I implement into my project; it doesn't work because the items are from an ini file.

 

 

EDIT: I found my mistake...

 

I didn't set the new value to empty so each time I select a different radio, it adds to the bottom of the list. All fixed.

Edited by Queener

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

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