iceberg Posted October 23, 2006 Posted October 23, 2006 expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> opt('MustDeclareVars', 1) Dim $listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index, $listview2, $Name, $Timing, $i, $Btn_Print GUICreate("ListView Sort", 392, 322) $listview = GUICtrlCreateListView("Names|Timings", 40, 30, 310, 149) $listview2 = GUICtrlCreateListView("Position", 191, 30, 310, 149) GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlSendMsg($listview2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($listview2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $i = 0 Do $Name = InputBox("Name", "Please Enter Participants Name.", "", "") $Timing = InputBox("Timing", "Please Enter the Timing (mn:ss:ms).", "", "") GUICtrlCreateListViewItem($Name & "|" & $Timing, $listview) If @error = 1 Then ExitLoop $i = $i + 1 Until $i = 4 GUICtrlCreateListViewItem("1", $listview2) GUICtrlCreateListViewItem("2", $listview2) GUICtrlCreateListViewItem("3", $listview2) GUICtrlCreateListViewItem("4", $listview2) _GUICtrlListViewSetColumnWidth ($listview, 0, 75) _GUICtrlListViewSetColumnWidth ($listview, 1, 75) _GUICtrlListViewSetColumnWidth ($listview, 2, 75) $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30) $Btn_Print = GUICtrlCreateButton("Print", 200, 260, 70, 30) GUISetState() Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount ($listview) ] While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit ExitLoop Case $msg = $listview ; sort the list by the column header clicked on _GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($listview)) EndSelect WEnd Exit Hi, Would appreciate if someone could help me with the following lines? Line 9 = Why doesn't the "Position" appear? Line 18 = Can I set a format for input whereby only this format is accepted? eg 88:88:88 Line 20 = Why is it that when I press Cancel, it doesn't exit the program? Line 33 = Anyway to do a printout of the "current sorting"? Thanks. mouse not found....scroll any mouse to continue.
GaryFrost Posted October 23, 2006 Posted October 23, 2006 $listview = GUICtrlCreateListView("Names|Timings", 10, 30, 180, 149) $listview2 = GUICtrlCreateListView("Position", 191, 30, 180, 149) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
cppman Posted October 23, 2006 Posted October 23, 2006 expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> opt('MustDeclareVars', 1) Dim $listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index, $listview2, $Name, $Timing, $i, $Btn_Print GUICreate("ListView Sort", 392, 322) $listview = GUICtrlCreateListView("Names|Timings", 0, 30, 200, 149) $listview2 = GUICtrlCreateListView("Position", (200), 30, 170, 149) GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlSendMsg($listview2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($listview2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $i = 0 Local $str = "" Do $Name = InputBox("Name", "Please Enter Participants Name.", "", "") $Timing = InputBox("Timing", "Please Enter the Timing (mn:ss:ms).", "", "") ; Do Block $str = StringSplit($Timing, ":") While (UBound($str)-1 <> 3) MsgBox(0, "", "Error!!!! Please enter the correct format") $Timing = InputBox("Timing", "Please Enter the Timing (mn:ss:ms).", "", "") $str = StringSplit($Timing, ":") WEnd GUICtrlCreateListViewItem($Name & "|" & $Timing, $listview) If @error = 1 Then ExitLoop $i = $i + 1 Until $i = 4 GUICtrlCreateListViewItem("1", $listview2) GUICtrlCreateListViewItem("2", $listview2) GUICtrlCreateListViewItem("3", $listview2) GUICtrlCreateListViewItem("4", $listview2) _GUICtrlListViewSetColumnWidth ($listview, 0, 75) _GUICtrlListViewSetColumnWidth ($listview, 1, 75) _GUICtrlListViewSetColumnWidth ($listview, 2, 75) $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30) $Btn_Print = GUICtrlCreateButton("Print", 200, 260, 70, 30) GUISetState() Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount ($listview) ] While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit ExitLoop Case $msg = $listview ; sort the list by the column header clicked on _GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($listview)) EndSelect WEnd Exit What do you mean by Printout? Miva OS Project
iceberg Posted October 23, 2006 Author Posted October 23, 2006 thanks for the GREAT help. prinout...what i meant was...the user needs to do a printout of the GUI in whatever "sort" state it is in. hope i am clear... mouse not found....scroll any mouse to continue.
cppman Posted October 23, 2006 Posted October 23, 2006 (edited) try this: expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> #include <file.au3> opt('MustDeclareVars', 1) opt('WinTitleMatchMode', 0) Dim $listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index, $listview2, $Name, $Timing, $i, $Btn_Print GUICreate("ListView Sort", 392, 322) $listview = GUICtrlCreateListView("Names|Timings", 0, 30, 200, 149) $listview2 = GUICtrlCreateListView("Position", (200), 30, 170, 149) GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlSendMsg($listview2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($listview2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $i = 0 Local $str = "" Do $Name = InputBox("Name", "Please Enter Participants Name.", "", "") $Timing = InputBox("Timing", "Please Enter the Timing (mn:ss:ms).", "", "") ; Do Block $str = StringSplit($Timing, ":") While (UBound($str)-1 <> 3) MsgBox(0, "", "Error!!!! Please enter the correct format") $Timing = InputBox("Timing", "Please Enter the Timing (mn:ss:ms).", "", "") $str = StringSplit($Timing, ":") WEnd GUICtrlCreateListViewItem($Name & "|" & $Timing, $listview) If @error = 1 Then ExitLoop $i = $i + 1 Until $i = 4 GUICtrlCreateListViewItem("1", $listview2) GUICtrlCreateListViewItem("2", $listview2) GUICtrlCreateListViewItem("3", $listview2) GUICtrlCreateListViewItem("4", $listview2) _GUICtrlListViewSetColumnWidth ($listview, 0, 75) _GUICtrlListViewSetColumnWidth ($listview, 1, 75) _GUICtrlListViewSetColumnWidth ($listview, 2, 75) $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30) $Btn_Print = GUICtrlCreateButton("Print", 200, 260, 70, 30) GUISetState() Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount ($listview) ] While (GUIGetMsg() <> -3) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit ExitLoop Case $msg = $listview ; sort the list by the column header clicked on _GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($listview)) case $msg =$Btn_Print PrintPage() EndSelect WEnd Exit Func PrintPage() local $f = FileOpen("print.txt", 1) For $i = 1 to 4 FileWriteLine($f, _GUICtrlListViewGetItemText($ListView, $i) & @CRLF) Next FileClose($f) _FilePrint(@ScriptDir & "\print.txt") EndFunc just a general idea.. your gonna have to-of course-manipulate it to work to your advantage. Edited October 23, 2006 by CHRIS95219 Miva OS Project
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now