PDA

View Full Version : Scrollbar vs Button_scroller



tdewitt274
January 22nd, 2010, 02:50
Is there a difference between the Scrollbar and the Button Scroller? I kind of prefer to see a Scrollbar in Story windows. Has anyone implemented this or can suggest how it is used?

Thanks in advance!

Moon Wizard
January 22nd, 2010, 05:21
The scroller control can scroll up and down as well as left to right, while the scrollbar can only scroll in one direction. Several months ago, the original SmiteWorks team released a scrollbar template sample, but it has not really been worked into any rulesets yet.

It would be good to know how people feel about the scroller control. It works better for maps I think, but I generally like the scrollbar idea better for all the other windows.

Cheers,
JPG

ddavison
January 22nd, 2010, 05:56
It is used in the launcher ruleset. You can see it in the patch notes section and the list of rulesets and extensions if you have enough to force it to scroll. It is a little more intuitive IMO. I will see if I can locate some details for you on how to implement it.

Foen
January 22nd, 2010, 06:15
Rolemaster also makes significant use of scrollbars, but these were developed and released before the SmiteWorks template control which, incidentally, broke the RMC ones due to the way the underlying FG engine was changed to make the SW scrollbar work. The RMC scrollbars were then 'fixed' to work with the new FG engine mechanics. The RMC scrollbars are used to control which part of the attack tables are visible, both horizontally and vertically, a bit like a spreadsheet.

The Base Ruleset also uses scrollbars in the DropDown controls, where there are more selection options than displayed items.

Stuart

ddavison
January 22nd, 2010, 06:34
Here it is:

Inside graphics_frames.xml


<framedef name="scrollbar">
<bitmap file="frames/scrollbar.png" />
<top rect="0,0,20,31" />
<middle rect="20,0,20,94" />
<bottom rect="0,31,20,31" />
<decal rect="0,62,20,32" />
</framedef>


Template: Placed in desktop_templates.xml for the launcher ruleset:


<template name="scrollbar">
<genericcontrol name="campaignscrollbar">
<anchored>
<left>
<anchor>right</anchor>
</left>
<top>
<anchor>top</anchor>
</top>
<size>
<width>10</width>
<height>10</height>
</size>
</anchored>
<frame>
<offset>5,4,5,4</offset>
<name>scrollbar</name>
</frame>
<invisible />
<script>
function update()
if targetcontrol then
local sx, px, vx, sy, py, vy = targetcontrol.getScrollState();
local tw, th = targetcontrol.getSize();

th = th + 2*marginy

if vy &lt; sy then
local pos = py/sy * th;
local height = vy/sy * th;

setAnchor("left", target[1], "right", "absolute", 1 + marginx);
setAnchoredWidth(10);

setAnchor("top", target[1], "top", "absolute", pos - marginy);
setAnchoredHeight(height);

setVisible(true);
else
setVisible(false);
end
end
end

function onInit()
targetcontrol = window[target[1]];

marginx = 0;
marginy = 0;
if barmargin and barmargin[1] and barmargin[1].x then
marginx = barmargin[1].x[1];
end
if barmargin and barmargin[1] and barmargin[1].y then
marginy = barmargin[1].y[1];
end

if targetcontrol then
targetcontrol.onScroll = update;
end
end

function onDrag(button, x, y, draginfo)
if targetcontrol then
if not dragging then
local sx, px, vx, sy, py, vy = targetcontrol.getScrollState();

dragstarty = y;
dragstartpos = py;
dragfactor = sy/vy;
end

dragging = true;
targetcontrol.setScrollPosition(0, dragstartpos + (y - dragstarty)*dragfactor);
end

return true;
end

function onDragEnd()
dragging = false;
end
</script>
</genericcontrol>
</template>



Usage (placed inside windowclass at the bottom of sheedata:


<scrollbar name="patchnotebar">
<barmargin>
<x>1</x>
<y>10</y>
</barmargin>
<target>patchnotes</target>
</scrollbar>

VenomousFiligree
January 22nd, 2010, 07:31
The one thing I believe that would benefit from having a scroll bar in the story windows is knowing whereabouts in the story frame you are, especially if it’s a big one. Otherwise I have no problem with things as they are.

Foen
January 22nd, 2010, 07:36
The other advantage about scrollbars is the ability to return to the top of a window (or navigate to the bottom) without having to hold down a scroller control for what seems like an age.

This is espcially true of some of the larger tracts of text in reference modules using inline index entries.