Computer Science Canada

Help, with my GUI Text Scroller

Author:  Namis [ Tue Jan 20, 2004 9:55 pm ]
Post subject:  Help, with my GUI Text Scroller

Whats up, having some problems with my scroll bars... ill post a peice of my code and continue explaining from there


code:
import GUI in "%oot/lib/GUI"
setscreen ("graphics:1012;700")
View.Set ("offscreenonly")
View.Set ("nobuttonbar")
var line : string
var f : int
var fontID : int := Font.New ("Arial:20:bold")
var file1text, file1title : int
const fileNameToBeViewed : string := "C:/Documents and Settings/Andrew/Desktop/Client Stuff/Andrews Test.txt"
forward proc File1

body proc File1
    View.Update
    open : f, fileNameToBeViewed, get
    if f = 0 then
        put "Unable to open '" + fileNameToBeViewed + "' : ", Error.LastMsg
        return
    end if
    View.Update
    GUI.SetBackgroundColour (grey)
    View.Update
    file1title := GUI.CreateLabelFull (20, 280, fileNameToBeViewed, 250, 0, GUI.CENTER, 0)
    View.Update
    file1text := GUI.CreateTextBoxFull (10, 10, 280, 265, GUI.INDENT, 0)
    View.Update
    GUI.Hide (file1text)


    GUI.SetScrollOnAdd (file1text, false)

    loop
        View.Update
        exit when eof (f)
        View.Update
        get : f, line : *
        View.Update
        GUI.AddLine (file1text, line)
        View.Update
    end loop

    GUI.SetTopLine (file1text, 20)
    View.Update
    GUI.Show (file1text)
    View.Update
    close : f
    View.Update
end File1


File1



%%%% Process Events%%%%%%%%%%
loop
    exit when GUI.ProcessEvent
end loop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%





Well thats the code, I believe im having a View.Update problem, but whenever i throw it inside my loop it seems to cause it to not display the GUI at all, If you hit Restore Down / Maximize button in the top right a few times, it will allow you to move the scroll bar, and then it will freeze, if you Maximize again, it will move the scroll bar...

Anyway any help with this would be nice and appreciated. Thanks


Edit : Fixed the Minimize issue, but is till have the scrolling problem.

Author:  Namis [ Tue Jan 20, 2004 11:52 pm ]
Post subject: 

Thanks to tony, Throw a View Update intot he GUI process events.. or take out view.set offscreenonly ...


tony pwns ;p

Author:  Tony [ Tue Jan 20, 2004 11:58 pm ]
Post subject: 

I truly do Laughing

and I think that 4.0.5's GUI should be modified to include View.UpdateArea 8)


: