Jump to content

EditBox side by side and bottom issue


 Share

Recommended Posts

Adding to the edit box box is adding more and doing the wrong to the beginning and end

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>

Global $ListElements[7] = ["ID-1-Apple", _
        "ID-2-Appricot", _
        "ID-3-Banana", _
        "ID-4-Cherry", _
        "ID-5-Grape", _
        "ID-6-Orange", _
        "ID-7-Tangerine"]

$Form1 = GUICreate("Form1", 934, 248)
$ListView1 = GUICtrlCreateListView("All|split", 8, 48, 355, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 250)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)

$Button1 = GUICtrlCreateButton("Ok", 368, 208, 147, 33)

$Edit1 = GUICtrlCreateEdit("", 368, 48, 553, 153)
GUICtrlSetData(-1, "")

$RadioBottom = GUICtrlCreateRadio("Sort bottom", 371, 13, 81, 17)
GUICtrlSetState($RadioBottom, $GUI_CHECKED)
$RadioSideBySide = GUICtrlCreateRadio("Sort Side By Side", 470, 13, 95, 17)

$ComboPer = GUICtrlCreateCombo("-", 654, 13, 81, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($ComboPer, "+|_|/|\|*|(|)| |#|&|")
$ComboEnd = GUICtrlCreateCombo("-", 838, 13, 81, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($ComboEnd, "+|_|/|\|*|(|)| |#|&|")

$CheckboxAddPer = GUICtrlCreateCheckbox("Add Per", 584, 16, 65, 17)
$CheckboxAddEnd = GUICtrlCreateCheckbox("Add End", 761, 17, 73, 17)

For $i = 0 To UBound($ListElements) - 1
    $aFruits = StringRegExp($ListElements[$i], "-(\w+)\W*$", 3)
    If IsArray($aFruits) Then
        GUICtrlCreateListViewItem($ListElements[$i] & "|" & $aFruits[0], $ListView1)
    EndIf
Next

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

        Case $Button1
            GUICtrlSetData($Edit1, "")
            $aReadComboPer = GUICtrlRead($ComboPer)
            $aReadComboEnd = GUICtrlRead($ComboEnd)

            For $x = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
                $alist = _GUICtrlListView_GetItemText($ListView1, $x, 1)

                If GUICtrlRead($RadioBottom) = 1 Then
                    GUICtrlSetData($Edit1, $alist & @CRLF, 1)
                ElseIf GUICtrlRead($RadioBottom) And GUICtrlRead($CheckboxAddPer) = 1 Then
                    GUICtrlSetData($Edit1, $aReadComboPer & $alist & @CRLF, 1)
                ElseIf GUICtrlRead($RadioBottom) And GUICtrlRead($CheckboxAddEnd) = 1 Then
                    GUICtrlSetData($Edit1, $alist & $aReadComboEnd & @CRLF, 1)
                ElseIf GUICtrlRead($RadioBottom) And GUICtrlRead($CheckboxAddEnd) And GUICtrlRead($CheckboxAddPer) = 1 Then
                    GUICtrlSetData($Edit1, $aReadComboPer & $alist & $aReadComboEnd & @CRLF, 1)
                EndIf

                If GUICtrlRead($RadioSideBySide) = 1 Then
                    GUICtrlSetData($Edit1, $alist, 1)
                ElseIf GUICtrlRead($RadioSideBySide) And GUICtrlRead($CheckboxAddPer) = 1 Then
                    GUICtrlSetData($Edit1, $aReadComboPer & $alist, 1)
                ElseIf GUICtrlRead($RadioSideBySide) And GUICtrlRead($CheckboxAddEnd) = 1 Then
                    GUICtrlSetData($Edit1, $alist & $aReadComboEnd, 1)
                ElseIf GUICtrlRead($RadioSideBySide) And GUICtrlRead($CheckboxAddEnd) And GUICtrlRead($CheckboxAddPer) = 1 Then
                    GUICtrlSetData($Edit1, $aReadComboPer & $alist & $aReadComboEnd, 1)
                EndIf
            Next

    EndSwitch
WEnd

 

Link to comment
Share on other sites

If I understand correctly, maybe something like this?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>

Global $ListElements[7] = ["ID-1-Apple", _
        "ID-2-Appricot", _
        "ID-3-Banana", _
        "ID-4-Cherry", _
        "ID-5-Grape", _
        "ID-6-Orange", _
        "ID-7-Tangerine"]

$Form1 = GUICreate("Form1", 934, 248)
$ListView1 = GUICtrlCreateListView("All|split", 8, 48, 355, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 250)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)

$Button1 = GUICtrlCreateButton("Ok", 368, 208, 147, 33)

$Edit1 = GUICtrlCreateEdit("", 368, 48, 553, 153)
GUICtrlSetData(-1, "")

$RadioBottom = GUICtrlCreateRadio("Sort bottom", 371, 13, 81, 17)
GUICtrlSetState($RadioBottom, $GUI_CHECKED)
$RadioSideBySide = GUICtrlCreateRadio("Sort Side By Side", 470, 13, 95, 17)

$ComboPer = GUICtrlCreateCombo("-", 654, 13, 81, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($ComboPer, "+|_|/|\|*|(|)| |#|&|")
$ComboEnd = GUICtrlCreateCombo("-", 838, 13, 81, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($ComboEnd, "+|_|/|\|*|(|)| |#|&|")

$CheckboxAddPer = GUICtrlCreateCheckbox("Add Per", 584, 16, 65, 17)
$CheckboxAddEnd = GUICtrlCreateCheckbox("Add End", 761, 17, 73, 17)

For $i = 0 To UBound($ListElements) - 1
    $aFruits = StringRegExp($ListElements[$i], "-(\w+)\W*$", 3)
    If IsArray($aFruits) Then
        GUICtrlCreateListViewItem($ListElements[$i] & "|" & $aFruits[0], $ListView1)
    EndIf
Next

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

        Case $Button1
            GUICtrlSetData($Edit1, "")

            For $x = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
                ;build record
                $sRec = ""
                If GUICtrlRead($CheckboxAddPer) = $GUI_CHECKED Then $sRec &= GUICtrlRead($ComboPer)
                $sRec &= _GUICtrlListView_GetItemText($ListView1, $x, 1)
                If GUICtrlRead($CheckboxAddEnd) = $GUI_CHECKED Then $sRec &= GUICtrlRead($ComboEnd)

                ;write record
                If GUICtrlRead($RadioBottom) = $GUI_CHECKED Then
                    GUICtrlSetData($Edit1, $sRec & @CRLF, 1)
                Else
                    GUICtrlSetData($Edit1, $sRec, 1)
                EndIf
            Next

    EndSwitch
WEnd

 

Link to comment
Share on other sites

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...