Changing Code from a PushButton to ListBox - Forum

Forum Navigation
You need to log in to create posts and topics.

Changing Code from a PushButton to ListBox

I was look for a way to change some code that came from an Image Viewer from Jim Brammer did in 2009. He uses a Button to Search for the Images and then show th one you want to select. What I would like to do is change the button to a Listbox and automatically load the images from the folder selected from the ListBox.

:GetImages
FileOpenBox "Open Images (Multiple)" "All Images|*.bmp;*.gif;*.jpg|BMP|*.BMP|JPG|*.JPG|GIF|*.GIF|Any File|*.*" "[LastImgDir]" "[ImgList]" "Multiple"

If "[ImgList]" "<>" ""

   DeleteArray "[File]" "All"
   DeleteArray "[Img]" "All"

   SearchStr ";" "[ImgList]" "[Pos]" ""
   SubStr "[ImgList]" "1" "[Pos]" "[LastImg]"
   StrDel "[ImgList]" "1" "[Pos]" "[ImgListTmp]"
   SetVar "[ImgList]" "[ImgListTmp];[LastImg]"

   StrParse "[ImgList]" ";" "[File]" "[List_Len]"

   FileExists "[PubDir]imglist.lst" "[List_Ex]"
   If "[List_Ex]" "=" "True"
      FileErase "[PubDir]imglist.lst"
   EndIf

   . Initiate Progress Vars & Dialog
   SetVar "[ProgressTxt]" "Generating Image List.  Please Wait..."
   SetVar "[ProgressObject]" "ProgressFillbar01"
   CustomWindow "" "-1" "-1" "ProgressDialog01" "DialogBox+NoCloseBtn"

   StrReplace "[ImgList]" ";" "[#13][#10]" "[WriteList]" ""
   FileWrite "[PubDir]imglist.lst" "All" "[WriteList]"
   SetVar "[WriteList]" ""

   SetVar "[Y]" "1"
   Loop "1" "20" "[LX]"
        SetVar "[Img[LX]]" "[File[Y]]"
        Math "[Y]+1" "" "[Y]"
   EndLoop

   CloseCustomWindow "ProgressDialog01"

   ShowObject "[ProgressObject]" "Wipe Right" "3"
   HideObject "[ProgressObject]" "None" "0"

   SetVar "[X]" "1"
   ExtractFilePath "[File1]" "[LastImgDir]"

   GoSub "INIT_TRACKBAR"

   EnableMenuItem "MenuItem5"
   EnableMenuItem "MenuItem11"
   EnableMenuItem "MenuItem12"

EndIf
Return

I understand that the FileOpenBox needs to go, but do not know how to change this code to get it to search its self and load the files. Any help would be  appreciated. I have attached a screenshot if it helps

Uploaded files:
  • You need to login to have access to uploads.