Jump to content

Recommended Posts

Posted

Hi

New colums always appear at left. I would like to know if I can tell listview to add new columns right or do I just have to reverse both arrays first?. When you click "Generate" button ¬(A&¬BvB&¬CvC&¬A) gets written backwards.

#include <GuiListView.au3>
#include <array.au3>
;¬(A&¬BvB&¬CvC&¬A)

GUICreate("Truth table", 800, 600)
$in = GUICtrlCreateInput("¬(A&¬BvB&¬CvC&¬A)", 0, 1, 195)
$gen = GUICtrlCreateButton("Generate", 200, 1)
$list = GUICtrlCreateListView("", 0, 25, 800, 575)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            Exit
        Case $gen
            GenerateTable(GUICtrlRead($in))
    EndSwitch
WEnd


Func GenerateTable($sExp)
    $ColWidth = 20
    _GUICtrlListView_DeleteAllItems($list)
    While _GUICtrlListView_GetColumnCount($list) > 0
        _GUICtrlListView_DeleteColumn($list, 0)
    WEnd
    $chars = GetChars($sExp)
    For $i = 1 to $chars[0]
        _GUICtrlListView_InsertColumn($list, 0,$chars[$i],$ColWidth)
    Next
    $aExp = StringSplit($sExp,"")
    For $i = 1 to $aExp[0]
        _GUICtrlListView_InsertColumn($list, 0,$aExp[$i],$ColWidth)
    Next

    GUICtrlCreateListViewItem("sdfds", $list)
EndFunc   ;==>GenerateTable

Func GetChars($sStr)
    $aChars = StringSplit($sStr,"")
    $sChars = ""
    For $i = 1 To $aChars[0]
        if StringRegExp ( $aChars[$i], "[A-Z]") Then
            If not StringInStr($sChars,$aChars[$i]) Then
                $sChars &= $aChars[$i]
            EndIf
        EndIf
    Next
    $aRet = StringSplit($sChars,"")
    _ArraySort($aRet,0,1)
    Return $aRet
EndFunc

edited

Posted

Hi,

New colums always appear at left. I would like to know if I can tell listview to add new columns right or do I just have to reverse both arrays first?

I don't think it's possible (never seen that), so why do you want do that?

You could create blank items and only write the items from the right.

Br, FireFox.

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
×
×
  • Create New...