Jump to content

Recommended Posts

Posted

Im haveing a problem. The button1 should open the file that yuo hade selected in List1 and display in Edit1

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Array.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form", 473, 295, 190, 130)
$List1 = GUICtrlCreateList("", 16, 24, 177, 97, BitOR($LBS_SORT,$WS_HSCROLL,$WS_BORDER))
$Edit1 = GUICtrlCreateEdit("", 208, 24, 249, 249, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "Quest")
$Button1 = GUICtrlCreateButton("Display", 64, 152, 75, 25, $WS_GROUP)
$Pic1 = GUICtrlCreatePic("img\img.jpg", 0, 0, 473, 295, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$path = "img\list\"
$a = _FileListToArray($path)
For $x = 1 To $a[0]
    $b = StringSplit($a[$x],".")
    GUICtrlSetData ( $List1, $b[1] )
next

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit


        Case $msg =  $Button1
            $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1)
            ShellExecute($a[$d],"",$path, $Edit1)




    EndSelect
WEnd
Posted

Where are you setting the data when you click the button? You have removed a lot from your example compared to your original code...

What I would do is use _GUICtrlListBox_GetCurSel($hWnd) to get the selected then (if I read your code correctly and can remember what _FileListToArray returns...) get the selected file from the array by $a[$index + 1] (horrible naming too. Try naming your variable $aFileList or something sensible).

Cheers,

Brett

Posted

Where are you setting the data when you click the button? You have removed a lot from your example compared to your original code...

What I would do is use _GUICtrlListBox_GetCurSel($hWnd) to get the selected then (if I read your code correctly and can remember what _FileListToArray returns...) get the selected file from the array by $a[$index + 1] (horrible naming too. Try naming your variable $aFileList or something sensible).

Cheers,

Brett

I only need to fix the button to display the data from the List box to EDIT1

Posted (edited)

Im having a small problem.

My Script does not open the file in in to edit1 only the file name not opening the file so you can see. Im only using .txt file in the list section

$path = "img\list\"
$a = _FileListToArray($path)
For $x = 1 To $a[0]
    $b = StringSplit($a[$x],".")
    GUICtrlSetData ( $List1, $b[1] )
next

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit


        Case $msg =  $Button1
            $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1)
        GUICtrlSetData($Edit1,"" & $a[$d])

    EndSelect
WEnd
Edited by AX5
Posted

You want to put the contents of the file into the edit?

You're not thinking. You've got 105 posts now. How can you not think? Sit back. Read your code? ARE YOU EVER TELLING THE EDIT BOX WHAT ITS MEANT TO DISPLAY!

For reading the file look at FileRead. Setting the data see post #4 in this thread.

Posted

Im haveing a problem. The button1 should open the file that yuo hade selected in List1 and display in Edit1

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Array.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form", 473, 295, 190, 130)
$List1 = GUICtrlCreateList("", 16, 24, 177, 97, BitOR($LBS_SORT,$WS_HSCROLL,$WS_BORDER))
$Edit1 = GUICtrlCreateEdit("", 208, 24, 249, 249, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "Quest")
$Button1 = GUICtrlCreateButton("Display", 64, 152, 75, 25, $WS_GROUP)
$Pic1 = GUICtrlCreatePic("img\img.jpg", 0, 0, 473, 295, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$path = "img\list\"
$a = _FileListToArray($path)
For $x = 1 To $a[0]
    $b = StringSplit($a[$x],".")
    GUICtrlSetData ( $List1, $b[1] )
next

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit


        Case $msg =  $Button1
            $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1)
            ShellExecute($a[$d],"",$path, $Edit1)




    EndSelect
WEnd

Only In RichEdit can review photos ...

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Array.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form", 473, 295, 190, 130)
$List1 = GUICtrlCreateList("", 16, 24, 177, 97, BitOR($LBS_SORT,$WS_HSCROLL,$WS_BORDER))
$Pic = GUICtrlCreatePic("", 208, 24, 249, 249, BitOR($SS_CENTERIMAGE,$SS_SUNKEN,$WS_HSCROLL,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetData(-1, "Quest")
$Button1 = GUICtrlCreateButton("Display", 64, 152, 75, 25, $WS_GROUP)
$Pic1 = GUICtrlCreatePic("img\img.jpg", 0, 0, 473, 295, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$path = "img\list\"
$a = _FileListToArray($path)
For $x = 1 To $a[0]
    $b = StringSplit($a[$x],".")
    GUICtrlSetData ( $List1, $b[1] )
next

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit


        Case $msg =  $Button1
            $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1)
            ShellExecute(@ScriptDir & "\" & $path & $a[$d],"", "")
            GUICtrlSetImage($Pic,@ScriptDir & "\" & $path & $a[$d], 0)





    EndSelect
WEnd

صرح السماء كان هنا

 

Posted

Only In RichEdit can review photos ...

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Array.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form", 473, 295, 190, 130)
$List1 = GUICtrlCreateList("", 16, 24, 177, 97, BitOR($LBS_SORT,$WS_HSCROLL,$WS_BORDER))
$Pic = GUICtrlCreatePic("", 208, 24, 249, 249, BitOR($SS_CENTERIMAGE,$SS_SUNKEN,$WS_HSCROLL,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetData(-1, "Quest")
$Button1 = GUICtrlCreateButton("Display", 64, 152, 75, 25, $WS_GROUP)
$Pic1 = GUICtrlCreatePic("img\img.jpg", 0, 0, 473, 295, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$path = "img\list\"
$a = _FileListToArray($path)
For $x = 1 To $a[0]
    $b = StringSplit($a[$x],".")
    GUICtrlSetData ( $List1, $b[1] )
next

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit


        Case $msg =  $Button1
            $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1)
            ShellExecute(@ScriptDir & "\" & $path & $a[$d],"", "")
            GUICtrlSetImage($Pic,@ScriptDir & "\" & $path & $a[$d], 0)





    EndSelect
WEnd

No. I want the text inside of the file in the list opens in Edit1

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...