Hello,
i would like to show file names from a poppath in a simple lister but I can't do it after several attempts.
Any help please? I don't find example into RapaGui doc.
Thanks!
Show files in a lister from poppath
Re: Show files in a lister from poppath
@ papiosaur
Not sure but is this what you are after.
Edit; Opps pasted the wrong one fixed now.
Cheers
Leo
Not sure but is this what you are after.
Code: Select all
/*** Make sure we have at least Hollywood 9.0! ****************************************************/
@VERSION 9,0
/*** Enable DPI-awareness so that our GUI looks sharp even on high DPI monitors *******************/
@OPTIONS {DPIAware = True}
/*** This script requires the RapaGUI plugin ******************************************************/
@REQUIRE "RapaGUI"
/*** setup GUI ************************************************************************************/
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
<window title="File Path Lister." id="window" width="600" height="400" notify="closerequest">
<vgroup color="#607B99">
<vgroup>
<poppath title="Please select a drawer..." notify="path"/>
<listview id="list" >
<column></column>
</listview>
</vgroup>
</vgroup>
</window>
</application>
]])
Function PopulateList(Dir$)
OpenDirectory(1, Dir$)
e = NextDirectoryEntry(1)
While e <> Nil
If e.type = #DOSTYPE_FILE
moai.DoMethod("list", "Insert", "Bottom", e.name)
EndIf
e = NextDirectoryEntry(1)
Wend
CloseDirectory(1)
EndFunction
/*** Handles all incoming events ******************************************************************/
Function E_EventFunc(msg)
Switch msg.action
Case "RapaGUI":
Switch msg.attribute
Case "Path":
PopulateList(msg.triggervalue)
Case "CloseRequest"
End
EndSwitch
EndSwitch
EndFunction
/*** listen to these events **********************************************************************/
InstallEventHandler({RapaGUI = E_EventFunc})
/*** main loop **********************************************************************************/
Repeat
WaitEvent
Forever
Cheers
Leo
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
Re: Show files in a lister from poppath
Thanks a lot Leo!!!
Work fine!!!
[EDIT] if i change text string i have an error... Error locking...
Work fine!!!
[EDIT] if i change text string i have an error... Error locking...
Re: Show files in a lister from poppath
"Path" case is for "Poppath", no problem with that but how do if i have 2 poppath and 2 listers... (1 poppath for one lister of course)
Re: Show files in a lister from poppath
Try this, it should be what you are after.
Cheers
Leo
Code: Select all
/*** Make sure we have at least Hollywood 9.0! ****************************************************/
@VERSION 9,0
/*** Enable DPI-awareness so that our GUI looks sharp even on high DPI monitors *******************/
@OPTIONS {DPIAware = True}
/*** This script requires the RapaGUI plugin ******************************************************/
@REQUIRE "RapaGUI"
/*** setup GUI ************************************************************************************/
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
<window title="File Path Lister." id="window" width="600" height="400" notify="closerequest">
<hgroup color="#607B99">
<vgroup>
<poppath id="pop1" title="Please select a drawer..." notify="path"/>
<listview id="list1" >
<column></column>
</listview>
</vgroup>
<vgroup>
<poppath id="pop2" title="Please select a drawer..." notify="path"/>
<listview id="list2" >
<column></column>
</listview>
</vgroup>
</hgroup>
</window>
</application>
]])
Function PopulateList(Dir$, List)
OpenDirectory(1, Dir$)
e = NextDirectoryEntry(1)
While e <> Nil
If e.type = #DOSTYPE_FILE
moai.DoMethod("list" .. List, "Insert", "Bottom", e.name)
EndIf
e = NextDirectoryEntry(1)
Wend
CloseDirectory(1)
moai.DoMethod("list" .. List, "jump", "bottom")
EndFunction
/*** Handles all incoming events ******************************************************************/
Function E_EventFunc(msg)
Switch msg.action
Case "RapaGUI":
Switch msg.attribute
Case "Path":
Switch msg.id
Case "pop1"
List = 1
PopulateList(msg.triggervalue, List)
Case "pop2"
List = 2
PopulateList(msg.triggervalue, List)
EndSwitch
Case "CloseRequest"
End
EndSwitch
EndSwitch
EndFunction
/*** listen to these events **********************************************************************/
InstallEventHandler({RapaGUI = E_EventFunc})
/*** main loop **********************************************************************************/
Repeat
WaitEvent
Forever
Leo
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
Re: Show files in a lister from poppath
Thanks a lot leo!!! Work fine!!!
i understand better the "Case" now
I have always Error locking... but i will try to that.
i understand better the "Case" now
I have always Error locking... but i will try to that.