Shailendra Vijayvergia <[EMAIL PROTECTED]> wrote: > i want to > display one line information in the text box. If the length of > information string is bigger than text-box width, then it should > display information in parts, ie, it will diplay a part of the > information at a time and other part will be displayed after few > milliseconds.
Hi Shailendra, Here's the simplified version of a behavior that might help. Cheers, James ---------------------------------------------------------------------------- -- SWAP LINES -- -- -- Simulates the way an LCD display in a mobile telephone will show -- a long line of text in short chunks. -- PROPERTY DECLARATIONS -- -- author-defined parameter property delay -- private properties property pMember property pScroll property pLineHeight property pTimeOut -- EVENT HANDLERS -- on beginSprite(me) delay = 1000 -- HARDCODED: use getPDL to customize me.mInitialize() end beginSprite on endSprite(me) pTimeOut.target = 0 pTimeOut.forget() end endSprite -- PUBLIC METHOD -- on mSetText(me, aString) --------------------------------------------- -- INPUT: <aString> should be a string -- ACTION: Restarts the swap line cycle with a new text string -------------------------------------------------------------------- if stringP(aString) then -- Reintitialize text display pMember.text = aString pMember.scrollTop = 0 pScroll = 0 -- Reinitialize timeOut pTimeOut.target = 0 pTimeOut.forget() pTimeOut = timeOut(string(me)).new(delay, #mSwapLine, me) end if end mSetString -- PRIVATE METHODS -- on mInitialize(me) --------------------------------------------------- -- SENT BY: beginSprite() -- ACTION: Prepares the sprite dimensions and creates a timeOut -- object to swap the lines of text on a regular basis -------------------------------------------------------------------- pMember = sprite(me.spriteNum).member pScroll = 0 -- Set the properties of the member so that the behavior will work pMember.boxType = #fixed pMember.wordWrap = TRUE pMember.scrollTop = 0 -- pScroll -- Set the height of the sprite to show only one line of text case pMember.type of #field: pLineHeight = pMember.lineHeight tRect = pMember.rect tRect.bottom = tRect.top + pLineHeight pMember.rect = tRect #text: pMember.topSpacing = 0 pLineHeight = pMember.charPosToLoc(1).locV + 1 pMember.height = pLineHeight pMember.fixedLineSpace = 0 end case -- Create a timeOut object to swap the lines on a regular basis pTimeOut = timeOut(string(me)).new(delay, #mSwapLine, me) end mInitialize on mSwapLine(me) ----------------------------------------------------- -- SENT BY: pTimeOut -- ACTION: Shows the next line of text after the chosen delay -------------------------------------------------------------------- tHeight = pMember.height - pLineHeight if not tHeight then -- There are no additional lines to swap in pTimeOut.period = 0 else if pScroll < tHeight then -- Scroll down to the next line pScroll = pScroll + pLineHeight else -- Scroll back up to the beginning pScroll = 0 end if pMember.scrollTop = pScroll end mSwapLine [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]