#!/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 fly 2 /* 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 2 R Managing HTML lists on the fly W Lucida Grande U Lucida Grande U Lucida Grande @U Lucida Grande AU Lucida Grande W Lucida Grande cREVGeneral scriptChecksum WTQд!Ii debugObjects bookmarks handlerList preOpenStack CleanStacktempScript prevHandler preOpenStackscriptSelection char 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
PHere 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 & "
" & kTab & kTab & "" & kTab & the short name of cd i of stack tStack \
& kTab & the long ID of cd i of stack tStack & "
" & kTab & "" & kTab & the short name of stack tStack \
& kTab & kTab & the long ID of stack tStack & "
" & kTab & kTab & "" & kTab & the short name of cd i of stack tStack \
& kTab & the long ID of cd i of stack tStack & "
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 x 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 @ 2 K cREVGeneral scriptChecksum ${y_u bookmarks revUniqueID 1108712105785handlerList )mouseMove mouseDown mouseUp mouseDoubleUpscriptSelection char 358 to 357prevHandler mouseDowntempScript scripton 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 Commands i 5 P cREVGeneral revUniqueID 1108714014189 Button epkon 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 cREVGeneral scriptChecksum i=4 bookmarks revUniqueID 1108713841241handlerList mouseUpscriptSelection char 329 to 328prevHandler mouseUptempScript scripton 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 `d M > . All cREVGeneral revUniqueID 1108713894957 Radio2 `d > \ Application cREVGeneral revUniqueID 1108713911251 Result #r cREVGeneral revUniqueID 1108725066440 html ) @ q 2 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 @( _ cREVGeneral scriptChecksum *Kٿ~#q bookmarks revUniqueID 1108727589664handlerList linkClickedscriptSelection char 256 to 255prevHandler linkClickedtempScript script Xon 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 withand 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