#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" Managing HTML lists on the fly2 /* HTML List Stack By Eric Chatonet 2/18/05 http://www.sosmartsoftware.com/ */ --------------------------------------------- on preOpenStack set the style of this stack to modeless set the loc of this stack to the screenLoc end preOpenStack --------------------------------------------- on CleanStack put empty into fld "Display" put empty into fld "Result" put empty into fld "html" put empty into fld "ListLabel" save this stack put "Done" end CleanStack 2RManaging HTML lists on the fly WLucida Grande ULucida Grande ULucida Grande @ULucida Grande AULucida Grande WLucida Grande cREVGeneralscriptChecksumWTQд!Ii debugObjects bookmarks handlerListpreOpenStack CleanStack tempScript prevHandler preOpenStackscriptSelectionchar 141 to 140script

/*

HTML List Stack

By Eric Chatonet

2/18/05

http://www.sosmartsoftware.com/

*/

---------------------------------------------

on preOpenStack

set the style of this stack to modeless

set the loc of this stack to the screenLoc

end preOpenStack

---------------------------------------------

on CleanStack

put empty into fld "Display"

put empty into fld "Result"

put empty into fld "html"

put empty into fld "ListLabel"

save this stack

put "Done"

end CleanStack

 P Here is the main handler: ############################################# on BuilHtmlList pList -- in this example, pList parameter is a list of the short names of the stacks returned by the revLoadedStacks function: -- see the docs about this built-in function ----- constant kTab = " " -- html tab value: using constant avoids typing it local tStack,tHtmlList -- used local variables ----- repeat for each line tStack in pList switch case tStack is among the lines of the mainstacks -- then this stack is not a substack -- build the html code: put "

" & kTab & the short name of stack tStack \ & kTab & kTab & kTab & the long ID of stack tStack & "

" & cr after tHtmlList -- 200083 is the ID of a stack icon that you can find in revIcons stack repeat with i = 1 to the number of cds of stack tStack -- build the html code for stack cards: put "

" & kTab & kTab & "" & kTab & the short name of cd i of stack tStack \ & kTab & the long ID of cd i of stack tStack & "

" & cr after tHtmlList -- 201458 is the ID of a card icon that you can find in revIcons stack end repeat break default -- then this stack is a substack -- build the html code for substacks: put "

" & kTab & "" & kTab & the short name of stack tStack \ & kTab & kTab & the long ID of stack tStack & "

" & cr after tHtmlList -- 200082 is the ID of a substack icon that you can find in revIcons stack repeat with i = 1 to the number of cds of stack tStack -- build the html code for substack cards: put "

" & kTab & kTab & "" & kTab & the short name of cd i of stack tStack \ & kTab & the long ID of cd i of stack tStack & "

" & cr after tHtmlList -- 201458 is the ID of a card icon that you can find in revIcons stack end repeat end switch end repeat ----- delete last char of tHtmlList -- return character set the htmlText of fld "Display" to tHtmlList end BuilHtmlList --------------------------------------------- -- Note that in each line item 5 is the long ID of the corresponding object -- in the display field, tabstops are positionned in order to hide this fifth item from the user -- I have added a horizontal scrollbar to the field: so you can see it :-) -- See the ShowTheResult handler below that uses this trick to display a result ############################################# on ShowTheResult pFlag local tLineNo ----- if the mouseLoc is within the rect of btn "Frame" or pFlag then -- a trick allowing field's scrollbars to work properly put the hilitedLine of fld "Display" into tLineNo set the itemDel to tab lock screen put item 5 of the hilitedText of fld "Display" into fld "Result" -- hidden information -- note that common text is used here, not HTML text put the htmlText of line (the hilitedLine of fld "Display") of fld "Display" into fld "Html" -- HTML value of the selected line set the hilitedLine of fld "Display" to tLineNo unlock screen end if end ShowTheResult R cREVGeneralscriptChecksum>(EQp4: bookmarks breakPoints handlerListBuilHtmlList ShowTheResultscriptSelection char 26 to 25 prevHandler BuilHtmlList tempScriptscript

Here is the main handler:

#############################################

on BuilHtmlList pList

-- in this example, pList parameter is a list of the short names of the stacks returned by the revLoadedStacks function:

-- see the docs about this built-in function

-----

constant kTab = "	" -- html tab value: using constant avoids typing it

local tStack,tHtmlList -- used local variables

-----

repeat for each line tStack in pList

switch

case tStack is among the lines of the mainstacks -- then this stack is not a substack

-- build the html code:

put "<p><b> <img src=" & quote & "200083" & quote & ">" & kTab & the short name of stack tStack \

& kTab & kTab & kTab & the long ID of stack tStack & "</b></p>" & cr after tHtmlList

-- 200083 is the ID of a stack icon that you can find in revIcons stack

repeat with i = 1 to the number of cds of stack tStack

-- build the html code for stack cards:

put "<p><i>" & kTab & kTab & "<img src=" & quote & "201458" & quote & ">" & kTab & the short name of cd i of stack tStack \

& kTab & the long ID of cd i of stack tStack & "</i></p>" & cr after tHtmlList

-- 201458 is the ID of a card icon that you can find in revIcons stack

end repeat

break

default -- then this stack is a substack

-- build the html code for substacks:

put "<p>" & kTab & "<img src=" & quote & "200082" & quote & ">" & kTab & the short name of stack tStack \

& kTab & kTab & the long ID of stack tStack & "</p>" & cr after tHtmlList

-- 200082 is the ID of a substack icon that you can find in revIcons stack

repeat with i = 1 to the number of cds of stack tStack

-- build the html code for substack cards:

put "<p><i>" & kTab & kTab & "<img src=" & quote & "201458" & quote & ">" & kTab & the short name of cd i of stack tStack \

& kTab & the long ID of cd i of stack tStack & "</i></p>" & cr after tHtmlList

-- 201458 is the ID of a card icon that you can find in revIcons stack

end repeat

end switch

end repeat

-----

delete last char of tHtmlList -- return character

set the htmlText of fld "Display" to tHtmlList

end BuilHtmlList

---------------------------------------------

-- Note that in each line item 5 is the long ID of the corresponding object

-- in the display field, tabstops are positionned in order to hide this fifth item from the user

-- I have added a horizontal scrollbar to the field: so you can see it :-)

-- See the ShowTheResult handler below that uses this trick to display a result

#############################################

on ShowTheResult pFlag

local tLineNo

-----

if the mouseLoc is within the rect of btn "Frame" or pFlag then

-- a trick allowing field's scrollbars to work properly

put the hilitedLine of fld "Display" into tLineNo

set the itemDel to tab

lock screen

put item 5 of the hilitedText of fld "Display" into fld "Result" -- hidden information

-- note that common text is used here, not HTML text

put the htmlText of line (the hilitedLine of fld "Display") of fld "Display" into fld "Html"

-- HTML value of the selected line

set the hilitedLine of fld "Display" to tLineNo

unlock screen

end if

end ShowTheResult

  @ Display xon mouseMove if the mouse is down then ShowTheResult -- C end mouseMove ------------------------------ on mouseDown ShowTheResult -- C end mouseDown ------------------------------ on mouseUp ShowTheResult -- C end mouseUp ------------------------------ on mouseDoubleUp local tObj ----- if the the long ID of stack "Home" is in fld "Display" then exit mouseDoubleUp ----- put fld "result" into tObj if tObj <> empty then go tObj end mouseDoubleUp @  2K cREVGeneralscriptChecksum ${y_u bookmarks revUniqueID 1108712105785 handlerList)mouseMove mouseDown mouseUp mouseDoubleUpscriptSelectionchar 358 to 357 prevHandler mouseDown tempScriptscript

on mouseMove

if the mouse is down then ShowTheResult -- C

end mouseMove

------------------------------

on mouseDown

ShowTheResult -- C

end mouseDown

------------------------------

on mouseUp

ShowTheResult -- C

end mouseUp

------------------------------

on mouseDoubleUp

local tObj

-----

if the the long ID of stack "Home" is in fld "Display" then exit mouseDoubleUp

-----

put fld "result" into tObj

if tObj <> empty then go tObj

end mouseDoubleUp

 `a Commandsi 5P  cREVGeneral revUniqueID 1108714014189Buttonepkon mouseUp lock screen BuilHtmlList revLoadedStacks(the label of btn the hilitedbuttonName of control (the owner of me)) -- C -- see card script set the hilitedLine of fld "Display" to 1 put "The list viewed by the user (" & the number of lines of fld "Display" && "lines):" into fld "ListLabel" ShowTheResult true -- C unlock screen end mouseUp C!Display Loaded Stacks cREVGeneralscriptChecksumi=4 bookmarks revUniqueID 1108713841241 handlerListmouseUpscriptSelectionchar 329 to 328 prevHandlermouseUp tempScriptscript

on mouseUp

lock screen

BuilHtmlList revLoadedStacks(the label of btn the hilitedbuttonName of control (the owner of me)) -- C

-- see card script

set the hilitedLine of fld "Display" to 1

put "The list viewed by the user (" & the number of lines of fld "Display" && "lines):" into fld "ListLabel"

ShowTheResult true -- C

unlock screen

end mouseUp

Radio1`dM>.All cREVGeneral revUniqueID 1108713894957 Radio2`d>\ Application cREVGeneral revUniqueID 1108713911251  Result #r cREVGeneral revUniqueID 1108725066440 html) @q2 cREVGeneral revUniqueID 1108725934461   ListLabel v cREVGeneral revUniqueID 1108726117367  Label Field  ` cREVGeneral revUniqueID 1108726193770 :Hidden info extracted from the text of the selected line:  Label Field  cREVGeneral revUniqueID 1108726244640 $The HTML text of the selected line: Field pon linkClicked pLink switch pLink case "Revolution documentation" go stack "RevDocs" break case "So Smart Software" revGoUrl "http://www.sosmartsoftware.com" break case "BuilHtmlList handler" edit script of this cd end switch end linkClicked @(_  cREVGeneralscriptChecksum*Kٿ~#q bookmarks revUniqueID 1108727589664 handlerList linkClickedscriptSelectionchar 256 to 255 prevHandler linkClicked tempScriptscriptX

on linkClicked pLink

switch pLink

case "Revolution documentation"

go stack "RevDocs"

break

case "So Smart Software"

revGoUrl "http://www.sosmartsoftware.com"

break

case "BuilHtmlList handler"

edit script of this cd

end switch

end linkClicked

 #How-To stack #004 by Eric Chatonet " 2/18/05 Initial release   45/27/05 Modified for Tutorial Picker compatibility @ @, xThis stack stack shows how is built with HTML a graphic list of the currently loaded stacks, substacks and their cards. w 0You will adapt the method to your own needs :-) / %About Revolution HTML basic features $ 8 Each line always begins with

and ends with

. @1600 @1606  4 Between these two basic tags you can enclose any text string between the appropriate tags to specify its style, color, font, etc. @1600 @1606   m In addition, many characters (tabs, accentuated vowels, specials characters) have a special vaue in HTML. @1600 @1606  i I Lastly, you can use the tag to include any image. @1600 @1606  " % , \ See the htmlText entry in the Revolution documentation for more details about HTML tags. @1600 @1606      ! 9" If you want, you can donwload too my freeware plugin Encoded Text Picker from So Smart Software web site: this translator will help you to understand how HTML is built since you will be able to test any styled, colored, etc. string in it. 5 5 H N _ About lists  7Here is the trick: the user never sees the whole list.  " 5 Important information for you and me are placed out of sight at the end of each line (here, it is the long ID of each object). @1600 @1606  ~ This way lets you fetch easily the right information from the hilitedText. Incidentally, sorting a list without any garbage is a child's play. @1600 @1606  = @ LE 5Well placed tab stops are enough to make the job :-) About list fields formatting  hWhen inserting images into a field, you have to adjust some properties to display information properly: T FixedLineHeight has to be set to true and textheight increased up to 16 or more. @1600 @1606    - 7 Top margin has to be increased too: then you will specify the margins separatly (for instance: 8,12,8,8 to increase top margin only). @1600 @1606   { About images  xYou can use any image but, for lists, it's better to use images whose heights are not taller than the used text height. XUse png if you need transparency. Otherwise, use compressed jpeg that are less heavy...  `v  SSS.png  Ion mouseDown revGoUrl "http://www.sosmartsoftware.com" end mouseDown *"-PNG  IHDR". pHYs.#.#x?v 9iCCPPhotoshop ICC profilexڝwTTϽwz0z.0. Qf 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ii@:TZVJ@, \͌o'zM[{@D}3<bhT``4Ӥ(IENDB` cREVGeneralscriptChecksum@݀w^/[f=j revUniqueID 1108729818834 bookmarks handlerList mouseDown tempScript prevHandlerscriptSelection char 57 to 56script

on mouseDown

revGoUrl "http://www.sosmartsoftware.com"

end mouseDown

 FrameEg cREVGeneral revUniqueID 1108730097182 @ Flche2.png Z PNG  IHDR Kpl_ pHYs  gAMA|Q cHRMz%u0`:o_FIDATxb?,Xv$ϯ.?~~e'P#@11 @?~23_k_?V@p /÷>|()%ţ,%-F2\@ *n w JU牓/_ o_ū(II` b`AM]Nk5 _ ,?d+@021~K?@fӬ ~W XXY};w<||| ߿}Kw^W@koǑ74;Gڷo_߿uLL7qe`&Fqϟ_sPuFFfbA8`(10r=zk~ TxNP`=l|,IENDB` cREVGeneral revUniqueID 1108739317372 Show ScriptEp5on mouseUp edit the script of this cd end mouseUp e cREVGeneralscriptChecksumLfB+s bookmarks revUniqueID 1108750093869 handlerListmouseUpscriptSelection char 40 to 39 prevHandler tempScriptscript

on mouseUp

edit the script of this cd

end mouseUp