Irgendwie sehe ich wohl den Wald vor lauter Bäumen nicht.
Wieso stimmt die Statuszeile hier nicht wenn man das Verzeichnis über das ExplorerListGadget wechselt?
Code: Alles auswählen
WindowWidth = 640
WindowHeight = 480
Distance = 10
ToolBarHeight = 10
ComboBoxHeight = 20
Enumeration ; Windows & StatusBars
#myWindow
#myStatusBar
EndEnumeration
Enumeration ; Gadgets
#myComboBoxGadget
#myExplorerTreeGadget
#myExplorerListGadget
#mySplitterGadget
EndEnumeration
WindowFlags | #PB_Window_SizeGadget
WindowFlags | #PB_Window_SystemMenu
WindowFlags | #PB_Window_ScreenCentered
Macro ComboBoxY
ToolBarHeight+Distance
EndMacro
Macro BodyY
ToolBarHeight+ComboBoxHeight+2*Distance
EndMacro
Macro BodyHeight
WindowHeight(#myWindow)-(BodyY+StatusBarHeight(#myStatusBar)+Distance)
EndMacro
If OpenWindow(#myWindow, #PB_Ignore, #PB_Ignore, WindowWidth, WindowHeight, "Menü Test", WindowFlags)
CreateStatusBar(#myStatusBar, WindowID(#myWindow))
AddStatusBarField(WindowWidth/2)
AddStatusBarField(#PB_Ignore) ; Größe dieses Feldes automatisch festlegen
ComboBoxGadget(#myComboBoxGadget, 0, ComboBoxY, WindowWidth(#myWindow), ComboBoxHeight, #PB_ComboBox_Editable)
ExplorerTreeGadget(#myExplorerTreeGadget, 0, BodyY, 0, 0, "*.wf;*.wfx",#PB_Explorer_AlwaysShowSelection|#PB_Explorer_AutoSort)
ExplorerListGadget(#myExplorerListGadget, 0, BodyY, 0, 0, "C:\", #PB_Explorer_AlwaysShowSelection|#PB_Explorer_FullRowSelect)
SplitterGadget(#mySplitterGadget, 0, BodyY, WindowWidth(#myWindow), BodyHeight, #myExplorerTreeGadget, #myExplorerListGadget, #PB_Splitter_Vertical|#PB_Splitter_Separator)
StatusBarText(#myStatusBar, 0, "Area 0")
StatusBarText(#myStatusBar, 1, "Area 1")
SetCurrentDirectory("C:\")
LastFolder.s = GetCurrentDirectory()
SetGadgetText(#myExplorerListGadget,LastFolder.s)
SetGadgetText(#myComboBoxGadget,LastFolder.s)
SetGadgetText(#myExplorerTreeGadget,LastFolder.s)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case #myExplorerTreeGadget ; EventGadget()
Select EventType()
Case #PB_EventType_Change ; #myExplorerTreeGadget - EventType()
SetCurrentDirectory(GetGadgetText(#myExplorerTreeGadget))
LastFolder.s=CurrentDirectory.s
CurrentDirectory.s=GetCurrentDirectory()
StatusBarText(#myStatusBar, 0, LastFolder.s)
StatusBarText(#myStatusBar, 1, CurrentDirectory.s)
SetGadgetText(#myComboBoxGadget,CurrentDirectory.s)
SetGadgetText(#myExplorerListGadget,CurrentDirectory.s)
EndSelect
Case #myExplorerListGadget ; EventGadget()
Select EventType()
Case #PB_EventType_Change ; #myExplorerListGadget - EventType()
If CurrentDirectory.s <> GetGadgetText(#myExplorerListGadget)
; Debug CurrentDirectory.s : Debug GetGadgetText(#myExplorerListGadget) : Debug " "
LastFolder.s=CurrentDirectory.s
CurrentDirectory.s=GetGadgetText(#myExplorerListGadget)
SetCurrentDirectory(CurrentDirectory.s)
Debug LastFolder.s : Debug CurrentDirectory.s : Debug " "
Delay (2000)
StatusBarText(#myStatusBar, 0, LastFolder.s)
StatusBarText(#myStatusBar, 1, CurrentDirectory.s)
SetGadgetText(#myComboBoxGadget,CurrentDirectory.s)
SetGadgetText(#myExplorerTreeGadget,CurrentDirectory.s)
Debug LastFolder.s : Debug CurrentDirectory.s : Debug "---"
EndIf
EndSelect
EndSelect
Case #PB_Event_SizeWindow ; WindowEvent()
ResizeGadget(#mySplitterGadget, #PB_Ignore, #PB_Ignore, WindowWidth(#myWindow), BodyHeight) ; Our 'master' splitter gadget
; die beiden im SplitterGadget liegenden Gadgets benötigen kein Resize
; das erledigt das SplitterGadget automatisch.
ResizeGadget(#myComboBoxGadget, #PB_Ignore, #PB_Ignore, WindowWidth(#myWindow), #PB_Ignore)
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
End
Die Lösung :
Bei "Case #PB_EventType_Change" ist ebenfalls eine If-Abfrage notwendig.
Ich habe noch ewas Kosmetik betrieben - in der Hoffnung, daß vielleicht irgendwer den Code gebrauchen kann.
2.edit
aktualisiert
Code: Alles auswählen
WindowWidth = 640
WindowHeight = 480
Distance = 10
ToolBarHeight = 10
ComboBoxHeight = 20
Enumeration ; Windows & StatusBars
#myWindow
#myStatusBar
EndEnumeration
Enumeration ; Gadgets
#myComboBoxGadget
#myExplorerTreeGadget
#myExplorerListGadget
#mySplitterGadget
EndEnumeration
WindowFlags | #PB_Window_SizeGadget
WindowFlags | #PB_Window_SystemMenu
WindowFlags | #PB_Window_ScreenCentered
ComboBoxFlags | #PB_ComboBox_Editable
ExplorerTreeFlags | #PB_Explorer_AlwaysShowSelection
ExplorerTreeFlags | #PB_Explorer_AutoSort
ExplorerListFlags | #PB_Explorer_AlwaysShowSelection
ExplorerListFlags | #PB_Explorer_FullRowSelect
SplitterFlags | #PB_Splitter_Vertical
SplitterFlags | #PB_Splitter_Separator
Macro ComboBoxY
ToolBarHeight+Distance
EndMacro
Macro BodyY
ToolBarHeight+ComboBoxHeight+2*Distance
EndMacro
Macro BodyHeight
WindowHeight(#myWindow)-(BodyY+StatusBarHeight(#myStatusBar)+Distance)
EndMacro
If OpenWindow(#myWindow, #PB_Ignore, #PB_Ignore, WindowWidth, WindowHeight, "Menü Test", WindowFlags)
CreateStatusBar(#myStatusBar, WindowID(#myWindow))
AddStatusBarField(WindowWidth/2)
AddStatusBarField(#PB_Ignore) ; Größe dieses Feldes automatisch festlegen
ComboBoxGadget(#myComboBoxGadget, 0, ComboBoxY, WindowWidth(#myWindow), ComboBoxHeight, ComboBoxFlags)
ExplorerTreeGadget(#myExplorerTreeGadget, 0, BodyY, 0, 0, "*.wf;*.wfx", ExplorerTreeFlags)
ExplorerListGadget(#myExplorerListGadget, 0, BodyY, 0, 0, "C:\", ExplorerListFlags)
SplitterGadget(#mySplitterGadget, 0, BodyY, WindowWidth(#myWindow), BodyHeight, #myExplorerTreeGadget, #myExplorerListGadget, SplitterFlags)
StatusBarText(#myStatusBar, 0, " ")
CurrentDirectory.s = "C:\"
SetCurrentDirectory(CurrentDirectory.s)
SetGadgetText(#myExplorerListGadget,CurrentDirectory.s)
SetGadgetText(#myComboBoxGadget,CurrentDirectory.s)
SetGadgetText(#myExplorerTreeGadget,CurrentDirectory.s)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case #myExplorerTreeGadget ; EventGadget()
Select EventType()
Case #PB_EventType_Change ; #myExplorerTreeGadget - EventType()
If CurrentDirectory.s <> GetGadgetText(#myExplorerTreeGadget)
SetCurrentDirectory(GetGadgetText(#myExplorerTreeGadget))
LastFolder.s=CurrentDirectory.s
CurrentDirectory.s=GetCurrentDirectory()
StatusBarText(#myStatusBar, 0, LastFolder.s)
StatusBarText(#myStatusBar, 1, CurrentDirectory.s)
SetGadgetText(#myComboBoxGadget,CurrentDirectory.s)
SetGadgetText(#myExplorerListGadget,CurrentDirectory.s)
EndIf
EndSelect
Case #myExplorerListGadget ; EventGadget()
Select EventType()
Case #PB_EventType_Change ; #myExplorerListGadget - EventType()
If CurrentDirectory.s <> GetGadgetText(#myExplorerListGadget)
LastFolder.s=CurrentDirectory.s
CurrentDirectory.s = GetGadgetText(#myExplorerListGadget)
StatusBarText(#myStatusBar, 0, LastFolder.s)
StatusBarText(#myStatusBar, 1, CurrentDirectory.s)
SetGadgetText(#myComboBoxGadget,CurrentDirectory.s)
SetGadgetText(#myExplorerTreeGadget,CurrentDirectory.s)
;SetCurrentDirectory(CurrentDirectory.s) - wird bei ExplorerListGadget nicht benötigt
EndIf
EndSelect
EndSelect
Case #PB_Event_SizeWindow ; WindowEvent()
ResizeGadget(#mySplitterGadget, #PB_Ignore, #PB_Ignore, WindowWidth(#myWindow), BodyHeight) ; Our 'master' splitter gadget
; die beiden im SplitterGadget liegenden Gadgets benötigen kein Resize
; das erledigt das SplitterGadget automatisch.
ResizeGadget(#myComboBoxGadget, #PB_Ignore, #PB_Ignore, WindowWidth(#myWindow), #PB_Ignore)
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
End