I am quite new at purebasic, i am having some trouble to display a text file and make listviewgadget resize when i resize the window.
Some one can help? or tell me if there is another way to do what i am trying to acomplish ?
Thanks to all!
Code: Select all
FileName$ = OpenFileRequester("", "", "Text (*.txt)|*.txt;*.bat|All files (*.*)|*.*", 0)
If ReadFile(0, FileName$)
If OpenWindow(0, 0, 0, 270, 140, "ListViewGadget", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar | #PB_Window_MaximizeGadget)
;If OpenWindow(0, 0, 0, 870, 140, "ListViewGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
; ListViewGadget(0, 10, 10, 250, 120)
ListViewGadget(0, 10, 10, 850, 120)
SendMessage_(GadgetID(0), #LB_SETHORIZONTALEXTENT, 850,0)
While Eof(0) = 0
line$ = VarString$ + ReadString(0) + #CRLF$
AddGadgetItem (0, -1, line$)
Wend
SetGadgetState(0, 9) ; set (beginning with 0) the tenth item as the active one
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
CloseFile(0)
EndIf


