RaZgRiZ

guiscrolllist 1.0

Feb 11th, 2012
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. // Specialised function that serves as a simple yet complex list selector that uses a slider scroll to utilise its full length.
  2. // Usage: /guiscrolllist <height> <width> $<list> <*1 looplist button action> <*2 sidepane extras> <index var> <selection var>
  3. //  *1) Use like you normally would, but CRITICALLY avoid using the (format) function. The following are used as substitutes:
  4. //      %1: list content, %2: index var content, %3: selection var content, %4: looplist var content.
  5. //  *2) Extra stuff to be placed on the right side of the pagelist. Independent section, format freely.
  6.  
  7. guiscrolllist = [
  8.     guilist [
  9.         if (!=s $arg5 "") [
  10.             guilist [arg5]
  11.             guibar
  12.         ]
  13.         guilist [
  14.             guistrut (- $arg2 3) 1
  15.             looplist s (sublist $arg3 $$arg6 $arg1) [
  16.                 if (=s (concatword "^f7" $s) $guirollovername) [$arg7 = $s]
  17.                 guibutton (format "^f7%1%2" (? (=s $$arg7 $s) "^f6") $s) (
  18.                     format $arg4 $arg3 $$arg6 $$arg7 $s
  19.                 ) cube
  20.             ]
  21.         ]
  22.         guistrut 1
  23.         guislider $arg6 0 (max (- (listlen $arg3) $arg1) 0)
  24.     ]
  25. ]
  26.  
  27.  
  28. // ---- GRAPHICAL EXAMPLE ----
  29.  
  30. newgui test [
  31.     guiscrolllist 10 32 $list [
  32.         say "%4"
  33.     ] [
  34.         guiimage "smileyface" [] 4 0 "data/cube.png"
  35.     ] "indexvar" "selvar"
  36. ]
Advertisement
Add Comment
Please, Sign In to add comment