Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How do u insert scroll bars???
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jas




PostPosted: Sat May 07, 2005 6:05 pm   Post subject: How do u insert scroll bars???

the title pretty much describes the help that i need. I need to insert both verticle and horizontal scroll bars in my program, so instead of the letters going to the begining of next line, they stay on the same line, and you can scroll right (and up and down). My program is not those small screen programs like the ones in the gui examples, its the default window size when you run a simple program. (i need the scroll bars to control the whole output screen) So can u guys help me out?

Thanks alot!
Sponsor
Sponsor
Sponsor
sponsor
chrispaks




PostPosted: Sat May 07, 2005 8:10 pm   Post subject: (No subject)

Something like this?

Quote:
% The "Sliders.dem" program.
% This demonstrates the Slider widget along with the GUI routines
% that use Slider widgets. [Enable, Disable, Show, Hide,
% SetPosition, SetSize, Refresh, SetSliderValue, Quit, SetSliderReverse,
% SetSliderMinMax, CreateHorizontalSlider, CreateVerticalSlider,
% ProcessEvent, Dispose]

import GUI % Must be included in a programs using the GPL

View.Set ("graphics:400;300,nobuttonbar") % Shrink the window to the minimum size

% The slider IDs
var verticalSlider, horizontalSlider : int

% The label ID
var minMaxLabel : int

% The button IDs
var reverseButton, enableDisableButton, showHideButton : int
var moveButton, resizeButton, refreshButton, setPositionButton : int
var setMinMaxButton, quitButton : int

% Variables used by the button routines
var enable := false % Whether to enable or disable the slider
var hide := true % Whether to hide or show the slider
var newValue := 50 % Value to set slider to
var minMax := 1 % Setting for min/max
var up := true % Whether to move the slider up or down
var big := false % Whether to make the slider big or small

% The routines the widgets call when pressed
% Called when vertical slider moved
procedure VerticalSliderMoved (value : int)
locate (1, 1)
put "Vertical Slider: ", value : 4 ..
end VerticalSliderMoved

% Called when horizontal slider moved
procedure HorizontalSliderMoved (value : int)
locate (2, 1)
put "Horizontal Slider: ", value : 4 ..
end HorizontalSliderMoved

% Called when enable/disable button is pressed
procedure EnableDisablePressed
locate (3, 1)
if enable then
put "Horizontal Slider Enabled " ..
GUI.Enable (horizontalSlider) % Enable Horizontal Slider
enable := false
GUI.SetLabel (enableDisableButton, "Disable Horizontal Slider")
else
put "Horizontal Slider Disabled " ..
GUI.Disable (horizontalSlider) % Disable Horizontal Slider
enable := true
GUI.SetLabel (enableDisableButton, "Enable Horizontal Slider")
end if
end EnableDisablePressed

% Called when show/hide button is pressed
procedure ShowHidePressed
locate (3, 1)
if hide then
put "Horizontal Slider Hidden " ..
GUI.Hide (horizontalSlider) % Hide Horizontal Slider
hide := false
GUI.SetLabel (showHideButton, "Show Horizontal Slider")
else
put "Horizontal Slider Shown " ..
GUI.Show (horizontalSlider) % Show Horizontal Slider
hide := true
GUI.SetLabel (showHideButton, "Hide Horizontal Slider")
end if
end ShowHidePressed

% Called when move button is pressed
procedure MovePressed
locate (3, 1)
if up then
put "Horizontal Slider Moved Up " ..
GUI.SetPosition (horizontalSlider, 60, maxy - 60)
% Move Horizontal Slider Right
up := false
GUI.SetLabel (moveButton, "Move Slider Down")
else
put "Horizontal Slider Moved Down " ..
GUI.SetPosition (horizontalSlider, 60, maxy - 110)
% Move Horizontal Slider Left
up := true
GUI.SetLabel (moveButton, "Move Slider Up")
end if
end MovePressed

% Called when refresh button is pressed
procedure RefreshPressed
Draw.FillBox (0, 0, maxx, maxy, GUI.GetBackgroundColour) % Clear the screen
GUI.Refresh % Redraw all the widgets on the screen
end RefreshPressed

% Called when set position button is pressed
procedure SetPositionPressed
locate (3, 1)
put "Horizontal Slider Set to ", newValue, " " ..
GUI.SetSliderValue (horizontalSlider, newValue)
newValue += 50
if newValue > 200 then
newValue := 50
end if
GUI.SetLabel (setPositionButton, "Set Slider To " + intstr (newValue))
end SetPositionPressed

% Called when set min/max is pressed
procedure SetMinMaxPressed
var newMin, newMax : int
case minMax of
label 0 :
newMin := - 100
newMax := 200
label 1 :
newMin := 0
newMax := 300
label 2 :
newMin := 50
newMax := 250
label 3 :
newMin := 100
newMax := 200
end case
GUI.SetSliderMinMax (horizontalSlider, newMin, newMax)
GUI.SetLabel (minMaxLabel, "Min: " + intstr (newMin) + " Max: " +
intstr (newMax))
minMax := (minMax + 1) mod 4
end SetMinMaxPressed

% Called when resize button is pressed
procedure ResizePressed
locate (3, 1)
if big then
put "Horizontal Slider Made Large " ..
% Move and Resize Horizontal Slider
GUI.SetSize (horizontalSlider, 250, 0)
big := false
GUI.SetLabel (resizeButton, "Make Slider Small")
else
put "Horizontal Slider Made Small " ..
% Move and Resize Horizontal Slider
GUI.SetSize (horizontalSlider, 150, 0)
big := true
GUI.SetLabel (resizeButton, "Make Slider Large")
end if
end ResizePressed

% Called when reverse button is pressed
procedure ReversePressed
locate (3, 1)
put "Sliders Direction Reversed " ..
GUI.SetSliderReverse (horizontalSlider)
GUI.SetSliderReverse (verticalSlider)
end ReversePressed

% Called when quit button is pressed.
procedure QuitPressed
GUI.Quit
end QuitPressed

% The main program
% Create the buttons
horizontalSlider := GUI.CreateHorizontalSlider (60, maxy - 110, 250, 50,
150, 50, HorizontalSliderMoved)
verticalSlider := GUI.CreateVerticalSlider (350, maxy - 110, 100, 50, 150,
50, VerticalSliderMoved)

% Create a label specifying the min/max of vertical slider
minMaxLabel := GUI.CreateLabelFull (60, maxy - 110, "Min: 50 Max: 150",
250, 50, GUI.CENTER + GUI.MIDDLE, 0)

% Create the dividing line
var line := GUI.CreateLine (0, maxy - 135, maxx, maxy - 135, 0)

% Create the buttons
enableDisableButton := GUI.CreateButton (20, maxy - 170, 170,
"Disable Horizontal Slider", EnableDisablePressed)
showHideButton := GUI.CreateButton (210, maxy - 170, 170,
"Hide Horizontal Slider", ShowHidePressed)
moveButton := GUI.CreateButton (20, maxy - 200, 170, "Move Slider Up",
MovePressed)
refreshButton := GUI.CreateButton (210, maxy - 200, 170, "Refresh",
RefreshPressed)
setPositionButton := GUI.CreateButton (20, maxy - 230, 170,
"Set Slider To 50", SetPositionPressed)
setMinMaxButton := GUI.CreateButton (210, maxy - 230, 170,
"Change Min/Max of Slider", SetMinMaxPressed)
resizeButton := GUI.CreateButton (20, maxy - 260, 170, "Make Slider Small",
ResizePressed)
reverseButton := GUI.CreateButton (210, maxy - 260, 170,
"Reverse Sliders Ends", ReversePressed)
quitButton := GUI.CreateButton (125, maxy - 290, 150, "Quit", QuitPressed)

% Process events, exit loop when GUI.QUIT called
loop
exit when GUI.ProcessEvent
end loop

% Do the clean up. Dispose of all but the main buttons.
GUI.Dispose (enableDisableButton)
GUI.Dispose (showHideButton)
GUI.Dispose (moveButton)
GUI.Dispose (refreshButton)
GUI.Dispose (setPositionButton)
GUI.Dispose (setMinMaxButton)
GUI.Dispose (resizeButton)
GUI.Dispose (reverseButton)
GUI.Dispose (quitButton)

% Create a label to indicate we're finished
var quitMessage := GUI.CreateLabelFull (0, 0, "Execution Terminated",
maxx, maxy - 135, GUI.CENTER + GUI.MIDDLE, 0)

Jas




PostPosted: Sat May 07, 2005 9:20 pm   Post subject: (No subject)

i am looking for something like that, but i dont know how to include those scrollbars in my program. for example, how would you put those scrollbars in this program, so it all fits on one line:

code:

put "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"


may not be the best example, but as long as you know wat i mean.

I looked in the turing reference too, but i still dont know how to actually use it in my program. thx for the help
Jas




PostPosted: Sun May 08, 2005 6:15 pm   Post subject: (No subject)

anybody... Please help cuz i need this program im working on done by tomorow.
Tony




PostPosted: Sun May 08, 2005 10:12 pm   Post subject: (No subject)

on the very top
Turing:

View.Set("graphics:800;600")

or whatever size you need.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: