KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Would someone PLEASE help me with the Listview Syntax.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Thu Oct 18, 2007 7:53 pm    Post subject: PEARLY; Something is still missing.... Reply with quote

Sad
ReadXML works fine and populates the Listview.
WriteXML exhibits my usual problem of not returning ANY values including COUNT
Code:

Function ReadXML
Dim $L,$X, $Show, $From, $Until, $FileN
If open(5,$Source+"\Playlist.xml",2)=0
 $L=readline(5)
 While @error = 0
 If trim($L)='<PlayList>'
  $X=$X+1
  $Show=left(right(trim(readline(5)),-6),-7)
  $ = Readline(5)
  $From=left(right(trim(readline(5)),-6),-7)
  $Until=left(right(trim(readline(5)),-7),-8)
  $ = Readline(5)
  $FileN=left(right(trim(readline(5)),-11),-12)

  $ = execute("$$PlayListViewItem$X = $$PlayListView.Items.Add($$System.ListViewItem($$FileN))")
  If $Show='TRUE'
   $ = execute("$$PlayListViewItem$X.Checked = 1")
  Else
   $ = execute("$$PlayListViewItem$X.Checked = 0")
  Endif
  $ = execute("$$PlayListViewItem$X.ForeColor = $$System.Color.FromName('WindowText')")
  $ = execute("$$PlayListViewItem$X.UseItemStyleForSubItems = 1")  ;True
  $ = execute("$$PlayListViewItem$X = $$PlayListView.Items.Item($$X).SubItems.Add($$System.ListViewSubItem($$From))")
  $ = execute("$$PlayListViewItem$X = $$PlayListView.Items.Item($$X).SubItems.Add($$System.ListViewSubItem($$To))")
 EndIF
 $L=readline(5)
 Loop
 $Total=$X
 $=close(5)
Else
 $=MakeNew
Endif
EndFunction
;-----------------------------------------
Function WriteXML
Dim $i, $y, $Show, $From, $Until, $FileN
For $i = 0 to $total -1;  NOTE: $Total used as $PlayListView.Items.Count -1 is Always 0
  $FileN = $PlayListView.Items.Item($i).SubItems.Item(0).Text
  $From  = $PlayListView.Items.Item($i).SubItems.Item(1).Text
  $To    = $PlayListView.Items.Item($i).SubItems.Item(2).Text
  $ = execute("$$Y = $$PlayListViewItem$i.Checked") ; Does not return true value
  If $Y = 1
   $Show='TRUE'
  Else
   $Show='FALSE'
  Endif
? $show+",FILE:"+$FileN+",FROM:"+$From+",TO:"+$to  ;All the values are empty ??
EndFunction

________
Vehicle Insurance Forums


Last edited by MACE1 on Sat Mar 12, 2011 5:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Thu Oct 18, 2007 9:29 pm    Post subject: Reply with quote

The way you're building the PLIST array is not very intuitive. You should build it like this:

array[x,y]

Code:

array[0,0] = ;Show value
array[0,1] = ;Index value
array[0,2] = ;From value
array[0,3] = ;Until value
array[0,4] = ;UniqueName value
array[0,5] = ;FileNames value
array[1,0] = ;Show value
array[1,1] = ;Index value
array[1,2] = ;From value
array[1,3] = ;Until value
array[1,4] = ;UniqueName value
array[1,5] = ;FileNames value
;...etc.


so each x represents a row in the ListView.

String manipulation for XML is too complicated. There is a much easier way to accomplish what you're trying to do. Check out the code below:

Change $XML to your PlayList.xml path and run the program.

Code:

Break On

$XML = "C:\xdata\KiXforms\PlayList.xml"
$xmlDOC = CreateObject("Microsoft.XMLDOM")
$xmlDoc.preserveWhiteSpace = 0
$xmlDoc.async = 0
$=$xmlDoc.load($XML)

$arr = ReturnCollInArray("NewDataSet/PlayList/UniqueName")

For Each $elem in $arr
   ? "Show: " + $xmlDoc.selectSingleNode("NewDataSet/PlayList[UniqueName='" + $elem + "']/Show").text
   ? "Index: " + $xmlDoc.selectSingleNode("NewDataSet/PlayList[UniqueName='" + $elem + "']/Show").text
   ? "From: " + $xmlDoc.selectSingleNode("NewDataSet/PlayList[UniqueName='" + $elem + "']/Show").text
   ? "Until: " + $xmlDoc.selectSingleNode("NewDataSet/PlayList[UniqueName='" + $elem + "']/Show").text
   ? "UniqueName: " + $elem
   ? "FileNames: " + $xmlDoc.selectSingleNode("NewDataSet/PlayList[UniqueName='" + $elem + "']/Show").text
   ? ""
Next

Sleep 15
Exit 0

;Returns unique collection as an array
Function ReturnCollInArray($xpath)
   Dim $arr, $icounter, $i, $xmlnodes
   
   $=$xmlDoc.load($XML)
   
   ReDim $arr[0]
   $icounter = 0
   $xmlnodes = $xmlDoc.selectNodes($xpath)
   For $i = 0 to $xmlnodes.length - 1
      ReDim Preserve $arr[$icounter]
      $arr[$icounter] = $xmlnodes.item($i).text
      $icounter = $icounter + 1
   Next
   $ReturnCollInArray = $arr
EndFunction


Instead of keeping track of a Global variable $TOTAL, you should just use the UBound of the $PLIST array.

Code:

For $i = 0 to UBound($PLIST)
    ;code
Next
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Fri Oct 19, 2007 3:54 pm    Post subject: IRONY Reply with quote

I appreciate the direction using the fixed array but in fact it is going full circle. The reason the original array got CHANGED to PLIST[Y,X] where X is the line and Y the individual elements was the ability to SORT arrays based on the last element in the array. That said having just resigned myself to dropping the fixed array and just using the listview which will work and reduce the data duplication you are now suggesting I do use it !

Based on the fact that it is very easy to read and write the XML which is after all a fixed structure which must be adhered to and currently works well, I don't at this stage really want to start again from scratch with that.

The issue has always been when I get the data into the listview I can't bloomin get it out again despite best efforts. If I can accurately read the contents of the 3 columns and check box a row at a time I will have finished.
Everything is now in place and working subject to simply getting these values out a row at a time. I can not understand why I am getting a nul count or values back from the loop based on your previous information.
It is using a form much like the many I have been trying for several weeks which is very depressing.

Could we PLEASE examine closely what it is that is stopping me returning the values which are visible in the list view and should therefore be readable. As soon as I can get that to work the rest is straight forward..

I can post all the code to date but the crux is the retrieving of data from a listview. This is the second project with the same issue hence the reason I initially was also using a standard array.

Many thanks for the help... Shocked
________
Box vaporizer


Last edited by MACE1 on Sat Mar 12, 2011 5:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Fri Oct 19, 2007 6:00 pm    Post subject: Reply with quote

The code for reading rows from the ListView was posted in my earlier posts. Except I only read the selected row. This will read all rows and return all column data.

Code:

For $i = 0 to $PlayListView.Items.Count - 1
   ? "Column 1: " + $PlayListView.Items.Item($i).Text
   For $j = 0 to $PlayListView.Items.Item($i).SubItems.Count - 1
      ? "Column " + CStr($j+1) + ": " + $PlayListView.Items.Item($i).SubItems.Item($j).Text
   Next
Next
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Fri Oct 19, 2007 8:43 pm    Post subject: Pearly, Download the attached ! Reply with quote

I agree the example you show looks like it should work.
Unfortunately it does not appear to.
I have set debug to on - line 444 on WriteXML and inserted your code exactly + a sleep 10 to display output.
Count is returning as 0 so no loop therefore no output. Even if I replace the loop with a number or even $total the retreived values are nul so no output.

Try it and see is all I can say. If this code WORKS on yours but not mine it must be a KIX.net version issue !
________
MEDICAL DISPENSARIES



Demo Presentation.zip
 Description:

Download
 Filename:  Demo Presentation.zip
 Filesize:  8.24 KB
 Downloaded:  858 Time(s)



Last edited by MACE1 on Fri Feb 18, 2011 5:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Fri Oct 19, 2007 10:42 pm    Post subject: Reply with quote

Can you tell me the reason behind using the Execute command in all places?

When control variables (e.g., PlayListView, etc) are not declared at the top of the program, KiXtart by default treats it as Global-like variables. Therefore they are accessible in any function.

When you have the SetOption Explicit turned on:

Code:

$ = SetOption("Explicit", "ON")


You must declare all variables. You can declare control variables either Globally or Locally. However, when declaring them locally and SetOption Explicit is turned on, you can still access the controls by using a method called FindControl from the Form control (assuming Form is declared Globally).

To use the FindControl method, you'll need to provide a name to each control you want to find using the Name property.

Here is an example:

Code:

$PlayListView = $System.ListView()
$PlayListView.name = "PlayListView"
$PlayListView.CheckBoxes = -1  ;True
$PlayListView.Dock = 1  ;Top
$PlayListView.GridLines = -1  ;True
$PlayListView.Height = 285
$PlayListView.MultiSelect = 0  ;False
$PlayListView.Sorting = 2  ;Descending
$PlayListView.AutoArrange = "True"
$PlayListView.View = $System.View_Details
$PlayListView.fullrowselect = -1    ;True
$PlayListView.doubleclick = 'ListViewItemClick()'
$PlayListView.KeyPress = 'ListViewItemKey()'
;$PlayListView.doubleclick = 'ListViewItemClick("PlayListView","PADSsched")'
;$PlayListView.KeyPress = 'ListViewItemKey("PlayListView","PADSsched")'
$nul = $PADSsched.Controls.Add($PlayListView)


You can see the second line sets the Name property to "PlayListView"

Now to find the control in a function you do the following:

Code:

Function PlayListView_Enum
    Dim $PlayListView, $i
   
    $PlayListView = $PADSsched.FindControl("PlayListView")

    For $i = 0 to $PlayListView.Items.Count - 1
        ? $PlayListView.Items.Item($i).Text
    Next
EndFunction


FindControl method takes in the name value of the particular control you want to find.

Now the problem I found in your code is the Execute commands in ReadXML() function. As a standard practice, I would restrain from using it. Instead, you can use the FindControl method or call the control variable directly (since SetOption Explicit is not turned on).

Code:

Function ReadXML
Dim $L,$X, $Show, $From, $Until, $FileN
If Open(5,$Source+"\Playlist.xml",2)=0
 $L=ReadLine(5)
 While @error = 0
 If Trim($L)='<PlayList>'
  $X=$X+1
  $Show=Left(Right(Trim(ReadLine(5)),-6),-7)
  $ = ReadLine(5)
  $From=Left(Right(Trim(ReadLine(5)),-6),-7)
  $To=Left(Right(Trim(ReadLine(5)),-7),-8)
  $ = ReadLine(5)
  $FileN=Left(Right(Trim(ReadLine(5)),-11),-12)

   $ = $PlayListView.Items.Add($System.ListViewItem($FileN))
   If $Show = 'TRUE'
      $.Checked = -1   
   Else
      $.Checked = 0
   EndIf
   $.ForeColor = $System.Color.FromName('WindowText')
   $.UseItemStyleForSubItems = 1 ;True
   $subitem = $.SubItems.Add($System.ListViewSubItem($From))
   $subitem = $.SubItems.Add($System.ListViewSubItem($To))
 EndIf
 $L=ReadLine(5)
 Loop
 $Total=$X
 $=Close(5)
Else
 $=MakeNew
EndIf
EndFunction


You also had set Left(Right(Trim(ReadLine(5)),-7),-Cool to $Until and not $To and therefore the To column was empty. Although a bit of extraneous work, might I suggest turning on SetOption Explicit so you know the variables you're using have been declared.
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Fri Oct 19, 2007 11:21 pm    Post subject: PEARLY Reply with quote

OK, Added the .name to the form and replaced ReadXML as illustraded.
Modified the WriteXML a few times to try to get output.
Neither Your original or my interpretation are pulling values from listview:
Code:

;-----------------------------------------
Function ReadXML
Dim $L,$X, $Show, $From, $Until, $FileN
If Open(5,$Source+"\Playlist.xml",2)=0
 $L=ReadLine(5)
 While @error = 0
 If Trim($L)='<PlayList>'
  $X=$X+1
  $Show=Left(Right(Trim(ReadLine(5)),-6),-7)
  $ = ReadLine(5)
  $From=Left(Right(Trim(ReadLine(5)),-6),-7)
  $To=Left(Right(Trim(ReadLine(5)),-7),-8)
  $ = ReadLine(5)
  $FileN=Left(Right(Trim(ReadLine(5)),-11),-12)
  $ = $PlayListView.Items.Add($System.ListViewItem($FileN))
  If $Show = 'TRUE'
     $.Checked = -1
  Else
     $.Checked = 0
  EndIf
  $.ForeColor = $System.Color.FromName('WindowText')
  $.UseItemStyleForSubItems = 1 ;True
  $subitem = $.SubItems.Add($System.ListViewSubItem($From))
  $subitem = $.SubItems.Add($System.ListViewSubItem($To))
 EndIf
 $L=ReadLine(5)
 Loop
 $Total=$X
 $=Close(5)
Else
 $=MakeNew
EndIf
EndFunction
;-----------------------------------------
Function WriteXML
Dim $y, $Show, $From, $Until, $FileN
;If Open(5,$Source+"\Playlist.tmp",5)=0
;$= WRITELINE(5,$Header+@crlf)
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim $PlayListView, $i
 $PlayListView = $PADSsched.FindControl("PlayListView")
 ;1 Pearly
    For $i = 0 to $PlayListView.Items.Count - 1
        ? $PlayListView.Items.Item($i).Text
    Next
 ;2 MACE1   based upon ReadXML syntax.
 For $i = 0 to $PlayListView.Items.Count - 1
  $FileN = $.SubItems.Item(0).Text
  $From  = $.SubItems.Item(1).Text
  $To    = $.SubItems.Item(2).Text
 Next
  $ = execute("$$Y = $$PlayListViewItem$i.Checked") ; How to restructure this one ?
  If $Y = 1
   $Show='TRUE'
  Else
   $Show='FALSE'
  Endif
? $show+",FILE:"+$FileN+",FROM:"+$From+",TO:"+$to
sleep 10
exit
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 $= WRITELINE(5,' <PlayList>'+@crlf)
 $= WRITELINE(5,'  <Show>'+$Show+'</Show>'+@crlf)
 $= WRITELINE(5,'  <Index>'+cstr($i+1)+'</Index>'+@crlf)
 If $From <>""
  $= WRITELINE(5,'  <From>'+$From+'</From>'+@crlf)
 Else
  $= WRITELINE(5,'  <From />'+@crlf)
 Endif
 If $To <>""
  $= WRITELINE(5,'  <Until>'+$To+'</Until>'+@crlf)
 Else
  $= WRITELINE(5,'  <Until />'+@crlf)
 Endif
 $= WRITELINE(5,'  <UniqueName>'+"P"+cstr($i+1)+'</UniqueName>'+@crlf)
 $= WRITELINE(5,'  <FileNames>'+$FileN+'</FileNames>'+@crlf)
 $= WRITELINE(5,' </PlayList>'+@crlf)
Next
;$= WRITELINE(5,$Footer+@crlf)
$=close(5)
If exist($Source+"\Playlist.old")
; del $Source+"\Playlist.old"
Endif
If exist($Source+"\Playlist.xml")
; move  $Source+"\Playlist.xml" $Source+"\Playlist.old" /c
Endif
If exist($Source+"\Playlist.tmp")
; move  $Source+"\Playlist.tmp" $Source+"\Playlist.xml" /c
Endif
else
 ? $Source+" _ "+@serror
EndIf
Endif
EndFunction
;-----------------------------------------

________
HERBALAIRE VAPORIZER


Last edited by MACE1 on Fri Feb 18, 2011 5:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Sat Oct 20, 2007 12:06 am    Post subject: Reply with quote

Okay, the reason why it's not returning anything is because WriteXML function is called after the Form.Visible = 0 (false).

The best way to resolve this is to create a Closing event for the Form and call WriteXML in the Closing event function.

Code:

$PADSsched.Closing = 'PADSsched_Closing()'


Code:

Function PADSsched_Closing()
   $ = WriteXML
   $PADSsched.Hide()
EndFunction


Be sure to comment WriteXML() call after MakeForm()

Here's the code to get all Items (including SubItems) and CheckBox state

Code:

Dim $i, $j

For $i = 0 to $PlayListView.Items.Count - 1
   ? "Check State: " + $PlayListView.Items.Item($i).Checked
   For $j = 0 to $PlayListView.Items.Item($i).SubItems.Count - 1
      ? "Column " + CStr($j+1) + ": " + $PlayListView.Items.Item($i).SubItems.Item($j).Text
   Next
Next
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Mon Oct 22, 2007 1:39 pm    Post subject: BULLS EYE Reply with quote

Very Happy
That got it.
I would NEVER have figured that one out.
I actually tried much earlier to write out from the edit page while the form WAS still open but this is a far better solution.

I have implemented this in a number of other scripts as a finish off - now I am bedinning to understand how things work. You have done me a great service here as I have been dipping back into this whenever time permitted and kept hitting the same wall.

Can I add data to a collection in the above manner without displaying it in a column. It would elliminate the need for traditional arrays and would certainly cut down the memory footprint. I could I suppose put columns outside the display area which would have the same result but may slow things down.

I enclose the finished article for those who follow afterwards.
NOTE: The reason for the simple means of writing the XML is purely SPEED as it is always going to be the same format.
Code:

 ;XML Playlist Editor
 BREAK ON
 $system = CreateObject("Kixforms.System")
 IF NOT $system
  $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
  QUIT()
 ENDIF
 $nul = $system.application.enablevisualstyles
 GLOBAL $ini
 GLOBAL $source
 GLOBAL $presdir
 GLOBAL $header
 GLOBAL $footer
 GLOBAL $MY
 GLOBAL $total
 GLOBAL $redo
 GLOBAL $selected
 if right(@SCRIPTNAME,4)=".kix"
  $ini=@scriptdir+"\"+left(@scriptname,-4)+".ini"
 Else
  $ini=@scriptdir+"\"+left(@scriptname,-3)+".ini"
 Endif
 $MY="%DOMAIN%"
:form
 $ = ReadINI
 $ = MakeForm
 IF $redo="Y"
  $redo=""
  GOTO Form
 ENDIF
 EXIT 0
 ;-----------------------------------------
 FUNCTION MakeForm
  DIM $cnt
  $MYsched = $system.form()
  $MYsched.formborderstyle = 1  ;FormBorderStyle_FixedSingle
  $MYsched.maximizebox = 0  ;False
  $MYsched.showintaskbar = 0  ;False
  $MYsched.startposition = 0  ;FormStartPosition_Manual
  $MYsched.size = $system.size(640,350) ;(Width,Height)
  $MYsched.text = "MY Presentation Scheduler"
  $MYsched.icon = $system.icon.frombitmap(MY_Icon())
  $MYsched.center
  $MYsched.closing = 'MYsched_Closing()'

  $tooltip = $system.tooltip()

  $playlistview = $system.listview()
  $playlistview.name = "PlayListView"
  $playlistview.checkboxes = -1  ;True
  $playlistview.dock = 1  ;Top
  $playlistview.gridlines = -1  ;True
  $playlistview.height = 285
  $playlistview.multiselect = 0  ;False
  $playlistview.sorting = 2  ;Descending
  $playlistview.autoarrange = "True"
  $playlistview.view = $system.view_details
  $playlistview.fullrowselect = -1    ;True
  $playlistview.keypress = 'ListViewItemKey'
  $nul = $MYsched.controls.add($playlistview)

  $playlistviewcolumn0 = $playlistview.columns.add($system.columnheader("[/]  = Presentation Active",520,$system.horizontalalignment_left))
  $playlistviewcolumn1 = $playlistview.columns.add($system.columnheader("From",50,$system.horizontalalignment_center))
  $playlistviewcolumn2 = $playlistview.columns.add($system.columnheader("To",50,$system.horizontalalignment_center))

  $addbtn = $system.button()
  $addbtn.height = 25
  $addbtn.left = 10
  $addbtn.text = "Add"
  $addbtn.top = 290
  $addbtn.width = 60
  $addbtn.click = "AddP"
  $nul = $MYsched.controls.add($addbtn)
  $tooltip.settooltip($addbtn,"Add an Item to the Playlist")

  $removebtn = $system.button()
  $removebtn.height = 25
  $removebtn.left = 85
  $removebtn.text = "Remove"
  $removebtn.top = 290
  $removebtn.width = 60
  $removebtn.click = "RemP"
  $nul = $MYsched.controls.add($removebtn)
  $tooltip.settooltip($removebtn,"Remove selected items from Playlist")

  $editbtn = $system.button()
  $editbtn.height = 25
  $editbtn.left = 160
  $editbtn.text = "Edit"
  $editbtn.top = 290
  $editbtn.width = 60
  $editbtn.click = "EditP"
  $nul = $MYsched.controls.add($editbtn)
  $tooltip.settooltip($editbtn,"Edit From & Until details")

  $clearallbtn = $system.button()
  $clearallbtn.height = 25
  $clearallbtn.left = 250
  $clearallbtn.text = "Clear All"
  $clearallbtn.top = 290
  $clearallbtn.width = 60
  $clearallbtn.click = "ClearAll"
  $nul = $MYsched.controls.add($clearallbtn)
  $tooltip.settooltip($clearallbtn,"Un-'tick' ALL items in playlist")

  $selallbtn = $system.button()
  $selallbtn.height = 25
  $selallbtn.left = 330
  $selallbtn.text = "Select All"
  $selallbtn.top = 290
  $selallbtn.width = 60
  $selallbtn.click = "SelectAll"
  $nul = $MYsched.controls.add($selallbtn)
  $tooltip.settooltip($selallbtn,"'Tick' ALL items in playlist")

  $newsbtn = $system.button()
  $newsbtn.height = 25
  $newsbtn.left = 425
  $newsbtn.text = "New Schedule"
  $newsbtn.top = 290
  $newsbtn.width = 90
  $newsbtn.click = "MakeNew"
  $nul = $MYsched.controls.add($newsbtn)
  $tooltip.settooltip($newsbtn,"Remove ALL and start a NEW playlist.")

  $prefbtn = $system.button()
  $prefbtn.height = 25
  $prefbtn.left = 530
  $prefbtn.text = "Preferences"
  $prefbtn.top = 290
  $prefbtn.width = 90
  $prefbtn.click = "Preferences"
  $nul = $MYsched.controls.add($prefbtn)
  $tooltip.settooltip($prefbtn,"Set default folder locations.")
  $ = ReadXML
  $MYsched.show  ;Displays the Form

  WHILE $MYsched.visible
   $nul = Execute($MYsched.doevents())
  LOOP
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION MYsched_Closing()
  $ = WriteXML
  $MYsched.hide()
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION ListViewItemKey() ; User Keyboard ENTER
  DIM $i,$key
  $key = $playlistview.keypresseventargs.keychar
  FOR $i = 0 TO $playlistview.items.count - 1
   IF $playlistview.items.item($i).selected = -1
    IF $key = "-" AND $playlistview.items.item($i).checked = -1
     $playlistview.items.item($i).checked = 0
    ENDIF
    IF $key = "+" OR $key = chr(13) AND $playlistview.items.item($i).checked = 0
     $playlistview.items.item($i).checked = -1
    ENDIF
   ENDIF
  NEXT
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION EditP()
  DIM $i, $L, $filen, $from, $to;, $PlayListView
  FOR $L = 0 TO $playlistview.items.count - 1
   IF $playlistview.items.item($L).selected = -1
    $i = $L
    $filen = $playlistview.items.item($i).subitems.item(0).text
    $from = $playlistview.items.item($i).subitems.item(1).text
    $to = $playlistview.items.item($i).subitems.item(2).text

    $playlistedit = $system.form()
    $playlistedit.font = $system.font("Tahoma",9,0) ;Regular
    $playlistedit.left = 8
    $playlistedit.maximizebox = 0  ;False
    $playlistedit.minimizebox = 0  ;False
    $playlistedit.size = $system.size(175,175) ;(Width,Height)
    $playlistedit.text = "EDIT From - To ["+cstr($i+1)+"]"
    $playlistedit.center

    $continuous = $system.checkbox()
    $continuous.left = 55
    $continuous.text = "Continuous"
    $continuous.top = 80
    $continuous.width = 90
    $continuous.checkchanged = 'ContCC'
    IF $from <>"" OR $to <>""
     $continuous.checked = 0
    ELSE
     $continuous.checked = -1
    ENDIF
    $nul = $playlistedit.controls.add($continuous)

    $contor = $system.label()
    $contor.height = 20
    $contor.left = 27
    $contor.text = "OR"
    $contor.textalign = 64  ;MiddleRight
    $contor.top = 82
    $contor.width = 25
    $nul = $playlistedit.controls.add($contor)

    $fromled = $system.label()
    $fromled.height = 20
    $fromled.left = 20
    $fromled.text = "FROM"
    $fromled.textalign = 64  ;MiddleRight
    $fromled.top = 30
    $fromled.width = 40
    $nul = $playlistedit.controls.add($fromled)

    $from#LEd = $system.label()
    $from#LEd.Height = 20
    $from#LEd.Left = 100
    $from#LEd.Text = ":"
    $from#LEd.TextAlign = 64  ;MiddleRight
    $from#LEd.Top = 30
    $from#LEd.Width = 5
    $nul = $playlistedit.controls.add($from#LEd)

    $toled = $system.label()
    $toled.height = 20
    $toled.left = 30
    $toled.text = "TO"
    $toled.textalign = 64  ;MiddleRight
    $toled.top = 55
    $toled.width = 30
    $nul = $playlistedit.controls.add($toled)

    $to#LEd = $system.label()
    $to#LEd.Height = 20
    $to#LEd.Left = 100
    $to#LEd.Text = ":"
    $to#LEd.TextAlign = 64  ;MiddleRight
    $to#LEd.Top = 55
    $to#LEd.Width = 5
    $nul = $playlistedit.controls.add($to#LEd)

    $hrmiled = $system.label()
    $hrmiled.height = 15
    $hrmiled.left = 37
    $hrmiled.text = "[24] Hours Mins."
    $hrmiled.textalign = 32  ;MiddleCenter
    $hrmiled.top = 10
    $hrmiled.width = 100
    $nul = $playlistedit.controls.add($hrmiled)

    $frhhtb = $system.textbox()
    $frhhtb.height = 20
    $frhhtb.left = 68
    IF $from <>""
     $frhhtb.text = left($from,2)
    ENDIF
    $frhhtb.top = 30
    $frhhtb.width = 30
    $frhhtb.lostfocus = 'EditFT("FrHH")'
    $nul = $playlistedit.controls.add($frhhtb)

    $frmmtb = $system.textbox()
    $frmmtb.height = 20
    $frmmtb.left = 105
    IF $from <>""
     $frmmtb.text = right($from,2)
    ENDIF
    $frmmtb.top = 30
    $frmmtb.width = 30
    $frmmtb.lostfocus = 'EditFT("FrMM")'
    $nul = $playlistedit.controls.add($frmmtb)

    $tohhtb = $system.textbox()
    $tohhtb.height = 20
    $tohhtb.left = 68
    IF $to <>""
     $tohhtb.text = left($to,2)
    ENDIF
    $tohhtb.top = 55
    $tohhtb.width = 30
    $tohhtb.lostfocus = 'EditFT("ToHH")'
    $nul = $playlistedit.controls.add($tohhtb)

    $tommtb = $system.textbox()
    $tommtb.height = 20
    $tommtb.left = 105
    IF $to <>""
     $tommtb.text = right($to,2)
    ENDIF
    $tommtb.top = 55
    $tommtb.width = 30
    $tommtb.lostfocus = 'EditFT("ToMM")'
    $nul = $playlistedit.controls.add($tommtb)

    $Accept = $system.button()
    $Accept.height = 20
    $Accept.left = 46
    $Accept.text = "A C C E P T"
    $Accept.top = 110
    $Accept.width = 78
    $Accept.click = 'EditP_Accept($i)'
    $nul = $playlistedit.controls.add($Accept)

    $playlistedit.show  ;Displays the Form

    WHILE $playlistedit.visible
     $ = Execute($playlistedit.doevents())
    LOOP
    debug off
   ENDIF
  NEXT
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION EditP_Accept($i)
  DIM $x, $From, $To
  $From=val($frhhtb.text+"."+$frmmtb.text)
  $To=val($tohhtb.text+"."+$tommtb.text)
  IF $continuous.checked = -1
   $playlistview.items.item($i).subitems.item(1).text = ""
   $playlistview.items.item($i).subitems.item(2).text = ""
   $playlistedit.hide
  EXIT
  ENDIF
  IF  $From = 0 AND  $To = 0
   $continuous.checked = -1
   $playlistview.items.item($i).subitems.item(1).text = ""
   $playlistview.items.item($i).subitems.item(2).text = ""
   $playlistedit.hide
  EXIT
  ENDIF
  $playlistview.items.item($i).subitems.item(1).text = right("00"+cstr(val($frhhtb.text)),2)+":"+right("00"+cstr(val($frmmtb.text)),2)
  $playlistview.items.item($i).subitems.item(2).text = right("00"+cstr(val($tohhtb.text)),2)+":"+right("00"+cstr(val($tommtb.text)),2)
  IF $playlistview.items.item($i).subitems.item(1).text = $playlistview.items.item($i).subitems.item(2).text
   $playlistview.items.item($i).subitems.item(1).text = ""
   $playlistview.items.item($i).subitems.item(2).text = ""
  ENDIF
  IF $From > $To
   $x = $playlistview.items.item($i).subitems.item(1).text
   $playlistview.items.item($i).subitems.item(1).text = $playlistview.items.item($i).subitems.item(2).text
   $playlistview.items.item($i).subitems.item(2).text = $x
  ENDIF
  $playlistedit.hide
 ENDFUNCTION
  ;-----------------------------------------
  FUNCTION EditFT($sw)
   SELECT
   CASE
    $sw = "FrHH"
    IF val($frhhtb.text) < 1
     $frhhtb.text="00"
    ENDIF
    IF val($frhhtb.text) > 23
     $frhhtb.text="23"
    ENDIF
   CASE
    $sw = "FrMM"
    IF val($frmmtb.text) < 1
     $frmmtb.text="00"
    ENDIF
    IF val($frmmtb.text) > 59
     $frmmtb.text="59"
    ENDIF
   CASE
    $sw = "ToHH"
    IF val($tohhtb.text) < 1
     $tohhtb.text="00"
    ENDIF
    IF val($tohhtb.text) > 23
     $tohhtb.text="23"
    ENDIF
   CASE
    $sw = "ToMM"
    IF val($tommtb.text) < 1
     $tommtb.text="00"
    ENDIF
    IF val($tommtb.text) > 59
     $tommtb.text="59"
    ENDIF
   ENDSELECT
   if $frhhtb.text<>"" or $frmmtb.text<>"" or $tohhtb.text<>"" or $tommtb.text<>""
     $continuous.checked = 0
   Endif
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION ContCC
   IF $continuous.checked = -1
    $frhhtb.text=""
    $frmmtb.text=""
    $tohhtb.text=""
    $tommtb.text=""
   ENDIF
  ENDFUNCTION
 ;-----------------------------------------
 FUNCTION  AddP ; Add to List
  $=FileDialog($presdir+"\", "MY", "Select a MY file.")
  IF $selected <>""
   $filen=$presdir+"\"+$selected
   $selected=""

   $ = execute("$$PlayListViewItem$total = $$PlayListView.Items.Add($$System.ListViewItem($$FileN))")
   $ = execute("$$PlayListViewItem$total.Checked = 0")
   $ = execute("$$PlayListViewItem$total.ForeColor = $$System.Color.FromName('WindowText')")
   $ = execute("$$PlayListViewItem$total.UseItemStyleForSubItems = 1")  ;True
   $ = execute("$$PlayListViewItem$total = $$PlayListView.Items.Item($$total).SubItems.Add($$System.ListViewSubItem(''))")
   $ = execute("$$PlayListViewItem$total = $$PlayListView.Items.Item($$total).SubItems.Add($$System.ListViewSubItem(''))")
  ENDIF
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION  RemP ; Remove Selected line
  DIM $i
  FOR $i = 0 TO $playlistview.items.count - 1
   IF $playlistview.items.item($i).selected = -1
    $playlistview.items.item($i).remove()
   ENDIF
  NEXT
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION  ClearAll  ; Untick ALL
  DIM $i
  FOR $i = 0 TO $playlistview.items.count - 1
   $playlistview.items.item($i).checked = 0
  NEXT
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION  SelectAll  ; Tick All
  DIM $x
  FOR $i = 0 TO $playlistview.items.count - 1
   $playlistview.items.item($i).checked = 1
  NEXT
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION MakeNew
  $total=0
  $playlistview.items.clear()
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION Preferences
  $MYsched.hide ; Hide Main Form
  $MYschedpref = $system.form()
  $MYschedpref.formborderstyle = 1  ;FormBorderStyle_FixedSingle
  $MYschedpref.maximizebox = 0  ;False
  $MYschedpref.minimizebox = 0  ;False
  $MYschedpref.showintaskbar = 0  ;False
  $MYschedpref.size = $system.size(400,150) ;(Width,Height)
  $MYschedpref.text = "Presentation Scheduler folder preferences"
  $MYschedpref.icon = $system.icon.frombitmap(MY_Icon())
  $MYschedpref.center

  $pllabx = $system.label()
  $pllabx.height = 15
  $pllabx.left = 50
  $pllabx.top = 15
  $pllabx.width=340
  $pllabx.text = "FOLDER containing the 'Playlist.xml' file ="
  $nul = $MYschedpref.controls.add($pllabx)

  $pllab = $system.label()
  $pllab.height = 15
  $pllab.left = 50
  $pllab.top = 34
  $pllab.width=340
  IF $source = ""
   $pllab.text = "%userprofile%\MY Documents"
  ELSE
   $pllab.text = $source
  ENDIF
  $nul = $MYschedpref.controls.add($pllab)

  $plbtn = $system.button()
  $plbtn.height = 25
  $plbtn.left = 10
  $plbtn.top = 20
  $plbtn.width = 30
  $plbtn.text = "..."
  $plbtn.click = 'PLpref'
  $nul = $MYschedpref.controls.add($plbtn)

  $fileslabx = $system.label()
  $fileslabx.height = 15
  $fileslabx.left = 50
  $fileslabx.top = 70
  $fileslabx.width=340
  $fileslabx.text = "FOLDER containing the Presentations ="
  $nul = $MYschedpref.controls.add($fileslabx)

  $fileslab = $system.label()
  $fileslab.height = 15
  $fileslab.left = 50
  $fileslab.top = 90
  $fileslab.width=340
  IF $presdir = ""
   $fileslab.text = "%userprofile%\MY Documents"
  ELSE
   $fileslab.text = $presdir
  ENDIF
  $nul = $MYschedpref.controls.add($fileslab)

  $filesbtn = $system.button()
  $filesbtn.height = 25
  $filesbtn.left = 10
  $filesbtn.top = 77
  $filesbtn.width = 30
  $filesbtn.text = "..."
  $filesbtn.click = 'FilePref'
  $nul = $MYschedpref.controls.add($filesbtn)

  $MYschedpref.show
  WHILE $MYschedpref.visible
   $= Execute($MYschedpref.doevents)
  LOOP
  $MYschedpref.close
  IF $source = ""  OR $presdir = ""
   $=messagebox("You MUST select the location Folder for"+chr(10)+"'PlayList.xml' and the PRESENTATIONS"+chr(10)+"in order to proceed !","REQUIRED INFORMATION NOT SET",,10)
   QUIT
  ENDIF

  $MYsched.show ; Show Main Form
 ENDFUNCTION
 ;-----------------------------------------
 FUNCTION PLpref
  $l=GUIDialog("Identify the 'FOLDER' containing 'PlayList.xml' file",$MY,16384)
  IF @error=0
   IF exist($l+"\PlayList.xml")
    $source=$l
    $pllab.text = $source
    $ = WriteINI
    $MYsched.close
    $redo="Y"
   ENDIF
   IF $source = ""
    $=messagebox("You MUST select the location Folder for"+chr(10)+"'PlayList.xml' in order to proceed!","REQUIRED INFORMATION NOT SET",,10)
    QUIT
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION FILEpref
   $l=GUIDialog("Identify the Default PRESENTATIONS 'folder'",$MY)
   IF @error=0 AND exist($l)
    $presdir=$l
    $fileslab.text = $presdir
    $ = WriteINI
    $MYsched.close
    $redo="Y"
   ENDIF
   IF $presdir = ""
    $=messagebox("You MUST select the location Folder for"+chr(10)+"the PRESENTATIONS folder to proceed!","REQUIRED INFORMATION NOT SET",,10)
    QUIT
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION ReadINI
   IF open(5,$ini,2)=0
    $l=readline(5)
    WHILE @error=0
     SELECT
     CASE
      $l='[Source]'
      $source=readline(5)
     CASE
      $l='[Presentations]'
      $presdir=readline(5)
     CASE
      $l='[Footer]'
      $footer=readline(5)
     CASE
      $l='[Header]'
      $header=readline(5)
      WHILE @error=0
       $l=readline(5)
       If $l<>""
        $header=$header+@crlf+$l
       Endif
      LOOP
     ENDSELECT
     $l=readline(5)
    LOOP
    $=close(5)
   ELSE
    $=MakeINI
   ENDIF
   IF $source="" OR $presdir=""
    $=presentations
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
Function MakeINI
Dim $L
 If not exist($INI)
  $Footer='</PlayLists>'

  $Header='<?xml version="1.0" standalone="yes"?>
<PlayLists>
  <xs:schema id="PlayLists" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="PlayLists" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="PlayList" msdata:CaseSensitive="False">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="Show" type="xs:boolean" minOccurs="0" />
                <xs:element name="Index" type="xs:short" minOccurs="0" />
                <xs:element name="From" type="xs:string" minOccurs="0" />
                <xs:element name="Until" type="xs:string" minOccurs="0" />
                <xs:element name="UniqueName" type="xs:string" minOccurs="0" />
                <xs:element name="FileNames" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>'
  $ = Preferences
  $ = WriteINI
 Else
  $=messagebox("Unable to READ or CREATE"+chr(10)+$INI+chr(10)+chr(10)+"Seek technical assistance !","E R R O R")
  Quit
 Endif
EndFunction
  ;-----------------------------------------
  FUNCTION WriteINI
   IF $source = "" OR $presdir=""
    EXIT
   ENDIF
   IF Exist($ini)
    DEL @scriptdir+"\"+left(@scriptname,-4)+".inx"
    MOVE $ini @scriptdir+"\"+left(@scriptname,-4)+".inx"
   ENDIF
   IF open(5,$ini,5)=0
    $=writeline(5,'[Source]'+@crlf+$source+@crlf)
    $=writeline(5,'[Presentations]'+@crlf+$presdir+@crlf)
    $=writeline(5,'[Footer]'+@crlf+$footer+@crlf)
    $=writeline(5,'[Header]'+@crlf+$header)
    $=close(5)
   ELSE
    $=messagebox("Unable to READ or CREATE"+chr(10)+$ini+chr(10)+chr(10)+"Seek technical assistance !","E R R O R")
    QUIT
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION ReadXML
   DIM $l,$x, $show, $from, $until, $filen
   IF Open(5,$source+"\Playlist.xml",2)=0
    $l=ReadLine(5)
    WHILE @error = 0
     IF Trim($l)='<PlayList>'
      $x=$x+1
      $show=Left(Right(Trim(ReadLine(5)),-6),-7)
      $ = ReadLine(5)
      $from=Left(Right(Trim(ReadLine(5)),-6),-7)
      $to=Left(Right(Trim(ReadLine(5)),-7),-8)
      $ = ReadLine(5)
      $filen=Left(Right(Trim(ReadLine(5)),-11),-12)
      $ = $playlistview.items.add($system.listviewitem($filen))
      IF $show = 'TRUE'
       $.checked = -1
      ELSE
       $.checked = 0
      ENDIF
      $.forecolor = $system.color.fromname('WindowText')
      $.useitemstyleforsubitems = 1 ;True
      $subitem = $.subitems.add($system.listviewsubitem($from))
      $subitem = $.subitems.add($system.listviewsubitem($to))
     ENDIF
     $l=ReadLine(5)
    LOOP
    $total=$x
    $=Close(5)
   ELSE
    $=MakeNew
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION WriteXML
   IF Open(5,$source+"\Playlist.tmp",5)=0
    $= WRITELINE(5,$header+@crlf)
    DIM $playlistview, $i, $y, $filen, $from, $to, $show
    $playlistview = $MYsched.findcontrol("PlayListView")
    FOR $i = 0 TO $playlistview.items.count - 1
     $y = $playlistview.items.item($i).checked
     $filen = $playlistview.items.item($i).subitems.item(0).text
     $from = $playlistview.items.item($i).subitems.item(1).text
     $to = $playlistview.items.item($i).subitems.item(2).text
     IF $y = -1
      $show='true'
     ELSE
      $show='false'
     ENDIF
     $= WRITELINE(5,'  <PlayList>'+@crlf)
     $= WRITELINE(5,'    <Show>'+$show+'</Show>'+@crlf)
     $= WRITELINE(5,'    <Index>'+cstr($i+1)+'</Index>'+@crlf)
     IF $from <>""
      $= WRITELINE(5,'    <From>'+$from+'</From>'+@crlf)
     ELSE
      $= WRITELINE(5,'    <From />'+@crlf)
     ENDIF
     IF $to <>""
      $= WRITELINE(5,'    <Until>'+$to+'</Until>'+@crlf)
     ELSE
      $= WRITELINE(5,'    <Until />'+@crlf)
     ENDIF
     $= WRITELINE(5,'    <UniqueName>'+"P"+cstr($i+1)+'</UniqueName>'+@crlf)
     $= WRITELINE(5,'    <FileNames>'+$filen+'</FileNames>'+@crlf)
     $= WRITELINE(5,'  </PlayList>'+@crlf)
    NEXT
    $= WRITELINE(5,$footer+@crlf)
    $=close(5)
    IF exist($source+"\Playlist.old")
     DEL $source+"\Playlist.old"
    ENDIF
    IF exist($source+"\Playlist.xml")
     MOVE  $source+"\Playlist.xml" $source+"\Playlist.old" /c
    ENDIF
    IF exist($source+"\Playlist.tmp")
     MOVE  $source+"\Playlist.tmp" $source+"\Playlist.xml" /c
    ENDIF
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION FileDialog($path, $filetype, OPTIONAL $title)
   IF $title = ""
    $title="Select files of type '"+$filetype+"'"
   ENDIF
   DIM $ht, $wd, $sl, $dcount, $sdir, $x, $maxdlen
   $dcount = 0
   $maxdlen = 0
   $sl=len($filetype)
   ; Read the file content of $Path into array
   $sfile=Dir($path)
   WHILE NOT @error
    ; Identify Files of Type $FileType
    IF GetFileAttr($path + $sfile) <> 16 AND right($sfile,$sl) = $filetype
     $dcount=$dcount+1
     REDIM PRESERVE $sdir[$dcount]
     $sdir[$dcount] = $sfile
     $x=len($sfile)
     IF $x > $maxdlen
      $maxdlen = $x
     ENDIF
    ENDIF
    $sfile = Dir()
   LOOP
   IF $maxdlen >0
    $ht=($dcount*15)+80
    IF $ht > 640
     $ht=640
    ENDIF
    $wd=($maxdlen*5)+50

    $fileform = $system.form()
    $fileform.size = $system.size($wd,$ht) ;(Width,Height)
    $fileform.formborderstyle = 1
    $fileform.text = $title
    $fileform.maximizebox = 0
    $fileform.minimizebox = 0
    $fileform.showintaskbar = 0
    $fileform.icon = $system.icon.frombitmap(MY_Icon())
    $fileform.center

    $filelv = $system.listview()
    $filelv.height = $ht-60
    $filelv.width = $wd-5
    $filelv.left = 0
    $filelv.top = 0
    ;$FileLV.Dock = 2
    $filelv.keydown = "KeyDownEvent()"
    $filelv.keypress = "SelectItemEvent()"
    $filelv.click = "OnClick()"
    $filelv.doubleclick = 'OK_Enter()'
    $filelv.multiselect = 0  ;False
    $filelv.sorting = 1  ;Ascending
    $filelv.view = $system.view_list
    $filelv.autoarrange = "True"
    $nul = $fileform.controls.add($filelv)

    $textbox = $system.textbox()
    $textbox.left = 0
    $textbox.top = $ht-56
    $textbox.width = $wd - 35
    $nul = $fileform.controls.add($textbox)

    $okenter = $system.button()
    $okenter.click = "OK_Enter()"
    $okenter.name = "OKEnter"
    $okenter.text = "OK"
    $okenter.width = 30
    $okenter.left = $wd-34
    $okenter.top = $ht-56
    $nul = $fileform.controls.add($okenter)
    $fileform.acceptbutton = $okenter

    FOR EACH $x IN $sdir
     IF $x<>""
      $ = $filelv.items.add($system.listviewitem($x))
     ENDIF
    NEXT

    $MYsched.hide ; Hide Main Form
    $fileform.show  ;Displays the Form
    WHILE $fileform.visible AND $selected=""
     $nul = Execute($fileform.doevents())
    LOOP
    $fileform.close
    $MYsched.show

   ELSE
    $=messagebox($title+chr(10)+$presdir,"NO FILES FOUND !",,10)
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION KeyDownEvent()
   $keycode = $filelv.keydowneventargs.keycode
   IF $keycode = 37 OR $keycode = 38 OR $keycode = 39 OR $keycode = 40
    $textbox.text = $filelv.focuseditem.text
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION onclick()
   $textbox.text = $filelv.focuseditem.text
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION SelectItemEvent()
   $textbox.text = $filelv.focuseditem.text
   IF $filelv.keypresseventargs.keychar = chr(13)
    IF $textbox.text <>""
     $selected=$textbox.text
    ENDIF
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION OK_Enter()
   $textbox.text = $filelv.focuseditem.text
   IF $textbox.text <>""
    $selected=$textbox.text
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
  FUNCTION GUIDialog($_title, OPTIONAL $_root, OPTIONAL $_mode)
   DIM $
   $=createobject("shell.application")
   $guidialog=$.browseforfolder(0,$_title,0+$_mode,$_root).self.path
   IF NOT len($guidialog)
    EXIT 1
   ENDIF
  ENDFUNCTION
  ;-----------------------------------------
FUNCTION MY_Icon()
ENDFUNCTION
;-----------------------------------------

________
Dodge power wagon


Last edited by MACE1 on Fri Feb 18, 2011 5:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Mon Oct 22, 2007 4:17 pm    Post subject: Reply with quote

I'm glad to help Wink

I'm not understanding your question here:

"Can I add data to a collection in the above manner without displaying it in a column. It would elliminate the need for traditional arrays and would certainly cut down the memory footprint. I could I suppose put columns outside the display area which would have the same result but may slow things down."

Do you want to add data to the ListView collection w/o displaying in the ListView? If this is what you asked, I'm not sure if this is possible.
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Mon Oct 22, 2007 4:29 pm    Post subject: Reply with quote

Exactly what I want.
The listview is an array. Each collection is a line.
In many circumstances I want MORE data than shown in the listview display ~ including 'flags' similar to check boxes.

I think I will need to make columns outside the viewable area.
________
Extreme q
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group