A real PB beginner here - been going about 2 weeks.
I want to show a directory (and contents) and get the user to select a (image) file which then gets loaded and worked on. Hard, huh?
What's wrong with this code:
If OpenWindow(0, 0, 0, 230, 220, "File example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
ExplorerTreeGadget(0, 10, 10, 280, 280, "C:\Documents And Settings\Alastair\My Documents\My Pictures\project\*.*")
EndIf
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Select EventType()
Case #PB_EventType_LeftClick : Debug "Click with left mouse button"
Case #PB_EventType_RightClick : Debug "Click with right mouse button"
Case #PB_EventType_LeftDoubleClick : Debug "Double-click with left mouse button"
Case #PB_EventType_RightDoubleClick : Debug "Double-click with right mouse button"
EndSelect
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
This seems to work for other gadget types but not with this one. What I'm expecting is that clicking on a file opens the Debug window....no it doesn't.
The rest of the code will be to get the actual file name and then use it for loading. How will that work?
I guess I may not have understood properly how this gadget really works.
[newbie] Explorer Tree Gadget problem
Code: Select all
If OpenWindow(0, 0, 0, 230, 220, "File example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
ExplorerTreeGadget(0, 10, 10, 280, 280, "C:\Documents And Settings\Alastair\My Documents\My Pictures\project\*.*")
EndIf
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Select EventType()
Case #PB_EventType_LeftDoubleClick
Select GetGadgetState(0)
Case #PB_Explorer_File
Debug "Double-clicked file : " + GetGadgetText(0)
Case #PB_Explorer_Directory
Debug "Double-clicked folder : " + GetGadgetText(0)
EndSelect
EndSelect
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
I may look like a mule, but I'm not a complete ass.