FG Spreadshirt Swag
  1. #1

    Scrollbar vs Button_scroller

    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!

  2. #2
    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

  3. #3
    ddavison's Avatar
    Join Date
    Sep 2008
    Posts
    6,140
    Blog Entries
    21
    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.

  4. #4
    Foen's Avatar
    Join Date
    Jan 2007
    Location
    Suffolk, England
    Posts
    2,007
    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

  5. #5
    ddavison's Avatar
    Join Date
    Sep 2008
    Posts
    6,140
    Blog Entries
    21
    Here it is:

    Inside graphics_frames.xml
    Code:
    	<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:
    Code:
    	<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:
    Code:
    <scrollbar name="patchnotebar">
    	<barmargin>
    		<x>1</x>
    		<y>10</y>
    	</barmargin>
    	<target>patchnotes</target>
    </scrollbar>

  6. #6
    VenomousFiligree's Avatar
    Join Date
    Sep 2006
    Location
    Plymouth, UK.
    Posts
    2,122
    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.

    Previously: MurghBpurn

  7. #7
    Foen's Avatar
    Join Date
    Jan 2007
    Location
    Suffolk, England
    Posts
    2,007
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in