Jump to content
Hobbyist

BitOR & BitAnd

Recommended Posts

Hobbyist

I have been reading the help files on BitOR & BitAnd and of course looked at several previous posts but as a newbie still unsure of them.

I have included the attached snippet from my code and am looking for some guidance on something I experienced.

Created a listview that is sometimes hidden (the listview is sortable). Within a button control the attached code is suppose to show the listview if it is hidden.  It works.  The button causes the listview to "show".  So I decided to sort the listview by clicking on one of the columns BEFORE hidding it. Now when using the button the hidden listview does NOT show.  So only IF I sort the listview , hide the listview and then try to show the listview does the code NOT work.  No sorting, it does work.

 

Objectively I am trying to check the state of the listview and then take an action.  It is just this part that has me stumped regarding the sort or no sort. The balance of everything else is fine. 

Thanks

Hobbyist

If BitAND(GUICtrlGetState($List3), $GUI_hide) = $GUI_hide Then
                    GUICtrlSetState($List3, $GUI_enABLE)
                    Sleep(50)
                    GUICtrlSetState($List3, $GUI_show)
                EndIf

 

Share this post


Link to post
Share on other sites
Melba23

Hobbyist,

if you post a reproducer script I will take a look - as any code I write is likely to differ so much from yours that it will be useless for debugging.

M23


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
Hobbyist

Here ya go!

1.enter a few items using the controls

2. use the hide and show buttons to see that listview is hidden and then shown

3. sort the listview 

4. use the hide button

5. use the show button and see that listview does NOT show.

 

thanks so much for such a quick response. and now the learning begins - HA!

Hobbyist

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <ColorConstants.au3>
#include <GuiComboBox.au3>

Global $iActive = 1
Global $sCategoryData = "|A|B|C|D|E|F|G"
Global $sVendorData = "|Kaa|Kab|L|M|Naa|Nab|O|P|Q"

$main = GUICreate("Vendor  Category Selection", 680, 401, 150, 100)

Local $idFilemenu = GUICtrlCreateMenu("&File")
Local $idRunmenu = GUICtrlCreateMenu("&Run")
Local $idLog = GUICtrlCreateMenuItem(" Log", $idRunmenu)
Local $idFileitem = GUICtrlCreateMenuItem("Set ", $idRunmenu)

$cCombo_Category = GUICtrlCreateCombo("", 10, 26, 70, 25)
GUICtrlSetData($cCombo_Category, $sCategoryData)

$AEamounts = GUICtrlCreateInput("", 96, 26, 70, 21)
GUICtrlSetState($AEamounts, $GUI_DISABLE)

$cCombo_Vendor = GUICtrlCreateCombo("", 274, 26, 300, 25)
GUICtrlSetData($cCombo_Vendor, "|Kaa|Kab|L|M|Naa|Nab|O|P|Q")
Local $tInfo
_GUICtrlComboBox_GetComboBoxInfo($cCombo_Vendor, $tInfo)
$hCombo_Vendor_Edit = DllStructGetData($tInfo, "hEdit")
$hCombo_Vendor = GUICtrlGetHandle($cCombo_Vendor)
GUICtrlSetState($cCombo_Vendor, $GUI_DISABLE)

$List1 = GUICtrlCreateListView("", 192, 72, 470, 260,  $LVS_SINGLESEL, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT)
GUICtrlSetBkColor($List1, $COLOR_aqua)
_GUICtrlListView_AddColumn($List1, "Vendor", 290)
_GUICtrlListView_AddColumn($List1, "Category", 90)
_GUICtrlListView_AddColumn($List1, "Amount", 160)

$List2 = GUICtrlCreateListView("", 15, 140, 145, 180, $LVS_SINGLESEL, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUICtrlSetBkColor($List2, $COLOR_aqua)
_GUICtrlListView_AddColumn($List2, "Category", 90)
_GUICtrlListView_AddColumn($List2, "Amount", 160)
GUICtrlSetState($List2, $GUI_HIDE)

$Button12 = GUICtrlCreateButton("Hide List1", 10, 60, 158, 33)
$Button13 = GUICtrlCreateButton("Show List1", 10, 100, 158, 33)

GUICtrlCreateLabel("Your Entries", 390, 53, 73, 17)
GUICtrlCreateLabel("Category", 16, 8, 54, 17)
GUICtrlCreateLabel("Amount", 104, 8, 50, 17)
GUICtrlCreateLabel("Vendor", 392, 8, 44, 17)

$cEnterPressed = GUICtrlCreateDummy()
$cDummy_Vendor = GUICtrlCreateDummy()

GUISetState(@SW_SHOW)

Global $aAccelKeys[1][2] = [["{ENTER}", $cEnterPressed]]
GUISetAccelerators($aAccelKeys)

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
_GUICtrlListView_RegisterSortCallBack($List1)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit

        Case $idLog
            GUICtrlSetState($List1, $GUI_SHOW)
            GUICtrlSetState($cCombo_Vendor, $GUI_SHOW)
            GUICtrlSetState($List2, $GUI_HIDE)
            $iActive = 1

        Case $idFileitem
            GUICtrlSetState($List2, $GUI_SHOW)
            GUICtrlSetState($List1, $GUI_HIDE)
            GUICtrlSetState($cCombo_Vendor, $GUI_HIDE)
            $iActive = 2

        Case $cCombo_Category
            GUICtrlSetState($AEamounts, BitOR($GUI_FOCUS, $GUI_ENABLE))

        Case $List1
            If GUICtrlSetState($List1, $GUI_focus) Then
                _GUICtrlListView_SortItems($List1, GUICtrlGetState($List1))

            EndIf


        Case $Button12 ;hide
            GUICtrlSetState($List1, $GUI_hide)
            GUICtrlSetState($List1, $GUI_disABLE)


        Case $Button13 ;show
            If BitAND(GUICtrlGetState($List1), $GUI_hide) = $GUI_hide Then
                    GUICtrlSetState($List1, $GUI_enABLE);
                    Sleep(100)
                    GUICtrlSetState($List1, $GUI_show)
                EndIf


        Case $cEnterPressed
            Switch _WinAPI_GetFocus()
                Case GUICtrlGetHandle($AEamounts)
                    Switch $iActive
                        Case 1
                            GUICtrlSetState($cCombo_Vendor, BitOR($GUI_FOCUS, $GUI_ENABLE))
                        Case 2
                            GUICtrlCreateListViewItem(GUICtrlRead($cCombo_Category) & "|" & GUICtrlRead($AEamounts), $List2)
                            GUICtrlSetData($cCombo_Category, $sCategoryData)
                            GUICtrlSetData($AEamounts, "")
                            GUICtrlSetState($cCombo_Category, $GUI_FOCUS)
                            GUICtrlSetState($AEamounts, $GUI_DISABLE)
                    EndSwitch
                Case $hCombo_Vendor_Edit
                    GUICtrlSendToDummy($cDummy_Vendor)

            EndSwitch

        Case $cCombo_Vendor, $cDummy_Vendor
            GUICtrlCreateListViewItem(GUICtrlRead($cCombo_Vendor) & "|" & GUICtrlRead($cCombo_Category) & "|" & GUICtrlRead($AEamounts), $List1)
            GUICtrlSetData($cCombo_Category, $sCategoryData)
            GUICtrlSetData($AEamounts, "")
            GUICtrlSetData($cCombo_Vendor, $sVendorData)
            GUICtrlSetState($cCombo_Category, $GUI_FOCUS)
            GUICtrlSetState($AEamounts, $GUI_DISABLE)
            GUICtrlSetState($cCombo_Vendor, $GUI_DISABLE)
    EndSwitch

WEnd
_GUICtrlListView_UnRegisterSortCallBack($List1)
Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
    $hWndFrom = $lParam
    $iCode = BitShift($wParam, 16) ; Hi Word
    If $hWndFrom = $hCombo_Vendor And $iCode = $CBN_EDITCHANGE Then
        _GUICtrlComboBox_AutoComplete($hCombo_Vendor)
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

 

Share this post


Link to post
Share on other sites
Melba23

Hobbyist,

The problem is in the way you are checking whether the ListView is visible - if you use a Global variable to track the state it works fine when I test:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <ColorConstants.au3>
#include <GuiComboBox.au3>

Global $iActive = 1
Global $sCategoryData = "|A|B|C|D|E|F|G"
Global $sVendorData = "|Kaa|Kab|L|M|Naa|Nab|O|P|Q"

Global $fVisible_1 = True

$main = GUICreate("Vendor  Category Selection", 680, 401, 150, 100)

Local $idFilemenu = GUICtrlCreateMenu("&File")
Local $idRunmenu = GUICtrlCreateMenu("&Run")
Local $idLog = GUICtrlCreateMenuItem(" Log", $idRunmenu)
Local $idFileitem = GUICtrlCreateMenuItem("Set ", $idRunmenu)

$cCombo_Category = GUICtrlCreateCombo("", 10, 26, 70, 25)
GUICtrlSetData($cCombo_Category, $sCategoryData)

$AEamounts = GUICtrlCreateInput("", 96, 26, 70, 21)
GUICtrlSetState($AEamounts, $GUI_DISABLE)

$cCombo_Vendor = GUICtrlCreateCombo("", 274, 26, 300, 25)
GUICtrlSetData($cCombo_Vendor, "|Kaa|Kab|L|M|Naa|Nab|O|P|Q")
Local $tInfo
_GUICtrlComboBox_GetComboBoxInfo($cCombo_Vendor, $tInfo)
$hCombo_Vendor_Edit = DllStructGetData($tInfo, "hEdit")
$hCombo_Vendor = GUICtrlGetHandle($cCombo_Vendor)
GUICtrlSetState($cCombo_Vendor, $GUI_DISABLE)

$List1 = GUICtrlCreateListView("", 192, 72, 470, 260,  $LVS_SINGLESEL)
_GUICtrlListView_SetExtendedListViewStyle($List1, BitOr($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUICtrlSetBkColor($List1, $COLOR_aqua)
_GUICtrlListView_AddColumn($List1, "Vendor", 290)
_GUICtrlListView_AddColumn($List1, "Category", 90)
_GUICtrlListView_AddColumn($List1, "Amount", 160)

$List2 = GUICtrlCreateListView("", 15, 140, 145, 180, $LVS_SINGLESEL)
_GUICtrlListView_SetExtendedListViewStyle($List2, BitOr($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUICtrlSetBkColor($List2, $COLOR_aqua)
_GUICtrlListView_AddColumn($List2, "Category", 90)
_GUICtrlListView_AddColumn($List2, "Amount", 160)
GUICtrlSetState($List2, $GUI_HIDE)

$Button12 = GUICtrlCreateButton("Hide List1", 10, 60, 158, 33)
$Button13 = GUICtrlCreateButton("Show List1", 10, 100, 158, 33)

GUICtrlCreateLabel("Your Entries", 390, 53, 73, 17)
GUICtrlCreateLabel("Category", 16, 8, 54, 17)
GUICtrlCreateLabel("Amount", 104, 8, 50, 17)
GUICtrlCreateLabel("Vendor", 392, 8, 44, 17)

$cEnterPressed = GUICtrlCreateDummy()
$cDummy_Vendor = GUICtrlCreateDummy()

GUISetState(@SW_SHOW)

Global $aAccelKeys[1][2] = [["{ENTER}", $cEnterPressed]]
GUISetAccelerators($aAccelKeys)

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
_GUICtrlListView_RegisterSortCallBack($List1)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUICtrlListView_UnRegisterSortCallBack($List1)
            Exit

        Case $idLog
            GUICtrlSetState($List1, $GUI_SHOW)
            GUICtrlSetState($cCombo_Vendor, $GUI_SHOW)
            GUICtrlSetState($List2, $GUI_HIDE)
            $iActive = 1

        Case $idFileitem
            GUICtrlSetState($List2, $GUI_SHOW)
            GUICtrlSetState($List1, $GUI_HIDE)
            GUICtrlSetState($cCombo_Vendor, $GUI_HIDE)
            $iActive = 2

        Case $cCombo_Category
            GUICtrlSetState($AEamounts, BitOR($GUI_FOCUS, $GUI_ENABLE))

        Case $List1
            If GUICtrlSetState($List1, $GUI_focus) Then
                _GUICtrlListView_SortItems($List1, GUICtrlGetState($List1))

            EndIf


        Case $Button12 ;hide
            If $fVisible_1 Then
                GUICtrlSetState($List1, $GUI_hide)
                GUICtrlSetState($List1, $GUI_DISABLE)
                $fVisible_1 = False
            EndIf


        Case $Button13 ;show
            If Not $fVisible_1 Then
                GUICtrlSetState($List1, $GUI_enABLE);
                Sleep(100)
                GUICtrlSetState($List1, $GUI_show)
                $fVisible_1 = True
            EndIf


        Case $cEnterPressed
            Switch _WinAPI_GetFocus()
                Case GUICtrlGetHandle($AEamounts)
                    Switch $iActive
                        Case 1
                            GUICtrlSetState($cCombo_Vendor, BitOR($GUI_FOCUS, $GUI_ENABLE))
                        Case 2
                            GUICtrlCreateListViewItem(GUICtrlRead($cCombo_Category) & "|" & GUICtrlRead($AEamounts), $List2)
                            GUICtrlSetData($cCombo_Category, $sCategoryData)
                            GUICtrlSetData($AEamounts, "")
                            GUICtrlSetState($cCombo_Category, $GUI_FOCUS)
                            GUICtrlSetState($AEamounts, $GUI_DISABLE)
                    EndSwitch
                Case $hCombo_Vendor_Edit
                    GUICtrlSendToDummy($cDummy_Vendor)

            EndSwitch

        Case $cCombo_Vendor, $cDummy_Vendor
            GUICtrlCreateListViewItem(GUICtrlRead($cCombo_Vendor) & "|" & GUICtrlRead($cCombo_Category) & "|" & GUICtrlRead($AEamounts), $List1)
            GUICtrlSetData($cCombo_Category, $sCategoryData)
            GUICtrlSetData($AEamounts, "")
            GUICtrlSetData($cCombo_Vendor, $sVendorData)
            GUICtrlSetState($cCombo_Category, $GUI_FOCUS)
            GUICtrlSetState($AEamounts, $GUI_DISABLE)
            GUICtrlSetState($cCombo_Vendor, $GUI_DISABLE)
    EndSwitch

WEnd
_GUICtrlListView_UnRegisterSortCallBack($List1)

Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
    $hWndFrom = $lParam
    $iCode = BitShift($wParam, 16) ; Hi Word
    If $hWndFrom = $hCombo_Vendor And $iCode = $CBN_EDITCHANGE Then
        _GUICtrlComboBox_AutoComplete($hCombo_Vendor)
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

I am off to watch the F1 Qualifying highlights now - I will investigate further tomorrow.

M23 


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
Melba23

Hobbyist,

And now to explain why your original code did not work.

If you read the Help file, you will see that GUICtrlGetState is a bit different when used on ListViews:

Exceptions:
For ListView controls it returns the number of the clicked column.

So when you checked the state of the control before sorting, no column had been clicked and the function would return -1. As BitAND looks at value at bit level, and -1 translates as 0xFFFFFFFF, using BitAnd would always return true regardless of the value of the second parameter and thus the check would always work regardless of the state of the control itself.

After having sorted the ListView, the function would return 0, 1 or 2 depending on which column had been clicked - none of which would give a positive return when BitAnded with $GUI_HIDE (0x00000020).

I hope that is all clear - please ask questions if not.

Personally I would suggest using a single button to show/hide the ListView, then you can use the button itself to track the state - something like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <ColorConstants.au3>
#include <GuiComboBox.au3>

Global $iActive = 1
Global $sCategoryData = "|A|B|C|D|E|F|G"
Global $sVendorData = "|Kaa|Kab|L|M|Naa|Nab|O|P|Q"

$main = GUICreate("Vendor  Category Selection", 680, 401, 150, 100)

Local $idFilemenu = GUICtrlCreateMenu("&File")
Local $idRunmenu = GUICtrlCreateMenu("&Run")
Local $idLog = GUICtrlCreateMenuItem(" Log", $idRunmenu)
Local $idFileitem = GUICtrlCreateMenuItem("Set ", $idRunmenu)

$cCombo_Category = GUICtrlCreateCombo("", 10, 26, 70, 25)
GUICtrlSetData($cCombo_Category, $sCategoryData)

$AEamounts = GUICtrlCreateInput("", 96, 26, 70, 21)
GUICtrlSetState($AEamounts, $GUI_DISABLE)

$cCombo_Vendor = GUICtrlCreateCombo("", 274, 26, 300, 25)
GUICtrlSetData($cCombo_Vendor, "|Kaa|Kab|L|M|Naa|Nab|O|P|Q")
Local $tInfo
_GUICtrlComboBox_GetComboBoxInfo($cCombo_Vendor, $tInfo)
$hCombo_Vendor_Edit = DllStructGetData($tInfo, "hEdit")
$hCombo_Vendor = GUICtrlGetHandle($cCombo_Vendor)
GUICtrlSetState($cCombo_Vendor, $GUI_DISABLE)

$List1 = GUICtrlCreateListView("", 192, 72, 470, 260,  $LVS_SINGLESEL, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT)
GUICtrlSetBkColor($List1, $COLOR_aqua)
_GUICtrlListView_AddColumn($List1, "Vendor", 290)
_GUICtrlListView_AddColumn($List1, "Category", 90)
_GUICtrlListView_AddColumn($List1, "Amount", 160)

$List2 = GUICtrlCreateListView("", 15, 140, 145, 180, $LVS_SINGLESEL, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUICtrlSetBkColor($List2, $COLOR_aqua)
_GUICtrlListView_AddColumn($List2, "Category", 90)
_GUICtrlListView_AddColumn($List2, "Amount", 160)
GUICtrlSetState($List2, $GUI_HIDE)

$Button_List1 = GUICtrlCreateButton("Hide List1", 10, 60, 158, 33)

GUICtrlCreateLabel("Your Entries", 390, 53, 73, 17)
GUICtrlCreateLabel("Category", 16, 8, 54, 17)
GUICtrlCreateLabel("Amount", 104, 8, 50, 17)
GUICtrlCreateLabel("Vendor", 392, 8, 44, 17)

$cEnterPressed = GUICtrlCreateDummy()
$cDummy_Vendor = GUICtrlCreateDummy()

GUISetState(@SW_SHOW)

Global $aAccelKeys[1][2] = [["{ENTER}", $cEnterPressed]]
GUISetAccelerators($aAccelKeys)

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
_GUICtrlListView_RegisterSortCallBack($List1)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $idLog
            GUICtrlSetState($List1, $GUI_SHOW)
            GUICtrlSetState($cCombo_Vendor, $GUI_SHOW)
            GUICtrlSetState($List2, $GUI_HIDE)
            $iActive = 1

        Case $idFileitem
            GUICtrlSetState($List2, $GUI_SHOW)
            GUICtrlSetState($List1, $GUI_HIDE)
            GUICtrlSetState($cCombo_Vendor, $GUI_HIDE)
            $iActive = 2

        Case $cCombo_Category
            GUICtrlSetState($AEamounts, BitOR($GUI_FOCUS, $GUI_ENABLE))

        Case $List1
            If GUICtrlSetState($List1, $GUI_focus) Then
                _GUICtrlListView_SortItems($List1, GUICtrlGetState($List1))

            EndIf


        Case $Button_List1
            Switch GUICtrlRead($Button_List1)
                Case "Hide List1"
                    GUICtrlSetState($List1, $GUI_hide)
                    GUICtrlSetState($List1, $GUI_disABLE)
                    GUICtrlSetData($Button_List1, "Show List1")
                Case "Show List1"
                    GUICtrlSetState($List1, $GUI_enABLE);
                    Sleep(100)
                    GUICtrlSetState($List1, $GUI_show)
                    GUICtrlSetData($Button_List1, "Hide List1")
            EndSwitch


        Case $cEnterPressed
            Switch _WinAPI_GetFocus()
                Case GUICtrlGetHandle($AEamounts)
                    Switch $iActive
                        Case 1
                            GUICtrlSetState($cCombo_Vendor, BitOR($GUI_FOCUS, $GUI_ENABLE))
                        Case 2
                            GUICtrlCreateListViewItem(GUICtrlRead($cCombo_Category) & "|" & GUICtrlRead($AEamounts), $List2)
                            GUICtrlSetData($cCombo_Category, $sCategoryData)
                            GUICtrlSetData($AEamounts, "")
                            GUICtrlSetState($cCombo_Category, $GUI_FOCUS)
                            GUICtrlSetState($AEamounts, $GUI_DISABLE)
                    EndSwitch
                Case $hCombo_Vendor_Edit
                    GUICtrlSendToDummy($cDummy_Vendor)

            EndSwitch

        Case $cCombo_Vendor, $cDummy_Vendor
            GUICtrlCreateListViewItem(GUICtrlRead($cCombo_Vendor) & "|" & GUICtrlRead($cCombo_Category) & "|" & GUICtrlRead($AEamounts), $List1)
            GUICtrlSetData($cCombo_Category, $sCategoryData)
            GUICtrlSetData($AEamounts, "")
            GUICtrlSetData($cCombo_Vendor, $sVendorData)
            GUICtrlSetState($cCombo_Category, $GUI_FOCUS)
            GUICtrlSetState($AEamounts, $GUI_DISABLE)
            GUICtrlSetState($cCombo_Vendor, $GUI_DISABLE)
    EndSwitch

WEnd

_GUICtrlListView_UnRegisterSortCallBack($List1)

Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
    $hWndFrom = $lParam
    $iCode = BitShift($wParam, 16) ; Hi Word
    If $hWndFrom = $hCombo_Vendor And $iCode = $CBN_EDITCHANGE Then
        _GUICtrlComboBox_AutoComplete($hCombo_Vendor)
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

M23

  • Like 2

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
232showtime

@Melba23,

is it possible to save data in the list view?

like for example I have 1 button(add) then if I click add button, child window will pop up and in child window there is also save and cancel button and Text box/input box, and if i type a string and click save child window will close and the string that i typed will be saved in the list view even if i close and open the whole program.

 

P.S.

Im planning to create a program same like the OP code...

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites
Melba23

232showtime,

A bit of a thread hijack there.....

Take a look at my GUIListViewEx UDF - the link is in my sig. Amongst its many functionalities, adding data to a ListView is there as is saving and reloading the content so that you can retain the content between runs.

M23

  • Like 1

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
Hobbyist

@Melba23

Thank you for the explanation.  I missed that totally (and feel really stupid over that!).  It ALL makes sense now - very much.

And I agree with you regarding the use of a single button.  I just threw 2 on there during the initial stages of coding.

 

Hobbyist

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

×