Re: Scrolling to a line in a field
Thanks - I'll select the line! 2009/1/12 Devin Asay > > On Jan 11, 2009, at 5:15 PM, David Bovill wrote: > > I have this old command - and just found that it is not accurate for a >> field >> of text with large line numbers. Can anyone make it more accurate? >> >> on field_ScrollToLine lineNum, fieldObject >> -- does not seem accurate for large line numbers (it's an underestimate) >> ??? >> >> if lineNum = 0 then >> put 0 into someScroll >> else if lineNum is a number then >> put the effective textheight of fieldObject into lineHeight >> put ((lineNum - 1) * lineHeight) * the height of fieldObject into >> someScroll >> end if >> set the scroll of fieldObject to someScroll >> end field_ScrollToLine >> ___ >> > > David, > > Could it be that the fixedLineHeight is off? That would mess up a handler > like this if there were varying sizes of text in the field. > > As an alternative, I have simply used 'select line lineNum' in list fields > and the engine will automatically scroll to that line. > > Regards, > > Devin > > > Devin Asay > Humanities Technology and Research Support Center > Brigham Young University > > ___ > use-revolution mailing list > use-revolution@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution > ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Scrolling to a line in a field
On Jan 11, 2009, at 5:15 PM, David Bovill wrote: I have this old command - and just found that it is not accurate for a field of text with large line numbers. Can anyone make it more accurate? on field_ScrollToLine lineNum, fieldObject -- does not seem accurate for large line numbers (it's an underestimate) ??? if lineNum = 0 then put 0 into someScroll else if lineNum is a number then put the effective textheight of fieldObject into lineHeight put ((lineNum - 1) * lineHeight) * the height of fieldObject into someScroll end if set the scroll of fieldObject to someScroll end field_ScrollToLine ___ David, Could it be that the fixedLineHeight is off? That would mess up a handler like this if there were varying sizes of text in the field. As an alternative, I have simply used 'select line lineNum' in list fields and the engine will automatically scroll to that line. Regards, Devin Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Scrolling to a line in a field
I have this old command - and just found that it is not accurate for a field of text with large line numbers. Can anyone make it more accurate? on field_ScrollToLine lineNum, fieldObject -- does not seem accurate for large line numbers (it's an underestimate) ??? if lineNum = 0 then put 0 into someScroll else if lineNum is a number then put the effective textheight of fieldObject into lineHeight put ((lineNum - 1) * lineHeight) * the height of fieldObject into someScroll end if set the scroll of fieldObject to someScroll end field_ScrollToLine ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: scrolling to a line
Hmm! I think that might do it. Thanks! I thought of that general approach (hadn't gotten the details worked out) -- but I guess I was thinking there might be a way to, in effect, intervene in the operations of lineOffset: to tell it, no no you just went one too far . . . Silly, I suppose. I could write a binary-search substitute for lineOffset . . . That's sillier. I think you probably have the best approach. Thanks again. I'll try it out tomorrow. Charles Hartman On Nov 13, 2005, at 10:40 PM, J. Landman Gay wrote: J. Landman Gay wrote: Charles Hartman wrote: I've modified Xavier's modification of my modification of (somebody's??) code to search incrementally in a sorted list field. Could it have been the one I posted about two years ago? I sent this to the list: local lUserKeys, lOldTicks on keyDown whichKey -- select from keyboard -- J. Landman Gay, 1990, modified for Revolution: 2003 if (the selectedField is not "") or (charToNum(whichKey) is among the items of "28,29,30,31") -- arrow keys then pass keyDown if the ticks - lOldTicks > 60 then put "" into lUserKeys put whichKey after lUserKeys put return & fld "myField" & return into tListText get lineoffset(cr&lUserKeys,tListText) if it > 0 then set the hilitedline of fld "myField" to it put the ticks into lOldTicks end keyDown But it doesn't solve one problem: suppose the user starts typing a > string that doesn't appear in the list? The easiest thing would be to just add a beep in this case, but if I have time today I'll see if I can rewrite it to accomodate. Is this closer? (Watch for line wrap): local lUserKeys, lOldTicks on keyDown whichKey -- select from keyboard -- J. Landman Gay, 1990, modified for Revolution: 2003, -- modifed for fuzzy selections 2005 if (the selectedField is not "") or (charToNum(whichKey) is among the items of "28,29,30,31") -- arrow keys then pass keyDown if the ticks - lOldTicks > 60 then put "" into lUserKeys put whichKey after lUserKeys put return & fld 1 & return into tListText get lineoffset(cr&lUserKeys,tListText) if it = 0 and the number of chars in lUserKeys = 1 then repeat until lineoffset(cr&lUserKeys,tListText) > 0 put charToNum(lUserKeys)+1 into tASCII if tASCII > 122 then exit repeat -- maximum key is "Z"; adjust if desired put numToChar(tASCII) into lUserKeys get lineoffset(cr&lUserKeys,tListText) end repeat if it = 0 then get the number of lines in fld 1 end if if it = 0 then get the hilitedline of fld 1 -- multi-char string with no match; leave alone set the hilitedline of fld 1 to it put the ticks into lOldTicks end keyDown -- Jacqueline Landman Gay | [EMAIL PROTECTED] HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: scrolling to a line
J. Landman Gay wrote: Charles Hartman wrote: I've modified Xavier's modification of my modification of (somebody's??) code to search incrementally in a sorted list field. Could it have been the one I posted about two years ago? I sent this to the list: local lUserKeys, lOldTicks on keyDown whichKey -- select from keyboard -- J. Landman Gay, 1990, modified for Revolution: 2003 if (the selectedField is not "") or (charToNum(whichKey) is among the items of "28,29,30,31") -- arrow keys then pass keyDown if the ticks - lOldTicks > 60 then put "" into lUserKeys put whichKey after lUserKeys put return & fld "myField" & return into tListText get lineoffset(cr&lUserKeys,tListText) if it > 0 then set the hilitedline of fld "myField" to it put the ticks into lOldTicks end keyDown But it doesn't solve one problem: suppose the user starts typing a > string that doesn't appear in the list? The easiest thing would be to just add a beep in this case, but if I have time today I'll see if I can rewrite it to accomodate. Is this closer? (Watch for line wrap): local lUserKeys, lOldTicks on keyDown whichKey -- select from keyboard -- J. Landman Gay, 1990, modified for Revolution: 2003, -- modifed for fuzzy selections 2005 if (the selectedField is not "") or (charToNum(whichKey) is among the items of "28,29,30,31") -- arrow keys then pass keyDown if the ticks - lOldTicks > 60 then put "" into lUserKeys put whichKey after lUserKeys put return & fld 1 & return into tListText get lineoffset(cr&lUserKeys,tListText) if it = 0 and the number of chars in lUserKeys = 1 then repeat until lineoffset(cr&lUserKeys,tListText) > 0 put charToNum(lUserKeys)+1 into tASCII if tASCII > 122 then exit repeat -- maximum key is "Z"; adjust if desired put numToChar(tASCII) into lUserKeys get lineoffset(cr&lUserKeys,tListText) end repeat if it = 0 then get the number of lines in fld 1 end if if it = 0 then get the hilitedline of fld 1 -- multi-char string with no match; leave alone set the hilitedline of fld 1 to it put the ticks into lOldTicks end keyDown -- Jacqueline Landman Gay | [EMAIL PROTECTED] HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: scrolling to a line
Method result is that every character has at least one line 1. you could start with A-Z on successive lines, sort, then retain only those letters whose next line is not that char. 2. put char 1 of each line into firstCharList; if {a-z} is not in firstCharList, then append it; finally sort, thus all characters are present in alphabetical order. Locating a single line with a single character = no other entries. Albert Hall Auditorium B - null, empty, nada, bupkis, we recommend backspacing now Concert in the Park Dolby Theater HTH Jim Ault Las Vegas On 11/13/05 12:29 PM, "Charles Hartman" <[EMAIL PROTECTED]> wrote: >> The second one, if applicable, it jumps to the line starting with >> the next best choice before the missing line... That way you see it's >missing. > > That's the one I'm finding elusive > >> Beeping is annoying... I'd rather have the hilite flash or something >> quiet... > > Yes, nothing I build beeps. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: scrolling to a line
I finally figured out where I got the original code which I quoted in my message http://lists.runrev.com/pipermail/use-revolution/2005-November/ 069934.html -- it was written by Klaus and posted on Ken's SoT site: http://www.sonsothunder.com/devres/revolution/tips/fld003.htm On Nov 13, 2005, at 3:03 PM, MisterX wrote: Here's a few more cool functions which windows implements which are not impractical when the case applies... If I keep pressing the same letter (since the start of filling the word), the line keeps going down until it reaches the last occurrence of the lines starting with that letter, then it starts back at the first line. Yes that would be handy (but not compatible with the full incremental search) The second one, if applicable, it jumps to the line starting with the next best choice before the missing line... That way you see it's missing. That's the one I'm finding elusive Beeping is annoying... I'd rather have the hilite flash or something quiet... Yes, nothing I build beeps. Is 3 seconds too much? Should the lastuserkeys should be wiped if we press deletekey or esc? I played around with it. I can easily get used to 2 seconds or even 1, and then it's handier in case of mistypes. But that's assuming you *know* about the delay. For the real world, 3 seconds seems to work as a good compromise. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: scrolling to a line
On Nov 13, 2005, at 3:04 PM, Dan Shafer wrote: FWIW, I don't think that's expected behavior or necessarily good user experience design. If there's no "find" then things should stay the same. Maybe a beep but a scroll to a phantom location doesn't really help me much, doesn't give me any new information. Well, it tells you one thing: there's no entry like what you just typed. In my case, the user may be double-clicking a line to choose it, or pressing an "Add New" button if the thing isn't found. But it doesn't solve one problem: suppose the user starts typing a string that doesn't appear in the list? If the first few letters match something, this scrolls to pretty close. But suppose nothing starts with 'Q' and the user starts by typing a 'q'? The list won't scroll at all. What would be nicer would be to scroll to the place where an item beginning with 'q' *would* be if there were one. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: scrolling to a line
FWIW, I don't think that's expected behavior or necessarily good user experience design. If there's no "find" then things should stay the same. Maybe a beep but a scroll to a phantom location doesn't really help me much, doesn't give me any new information. My $0.02. On Nov 13, 2005, at 8:08 AM, Charles Hartman wrote: But it doesn't solve one problem: suppose the user starts typing a string that doesn't appear in the list? If the first few letters match something, this scrolls to pretty close. But suppose nothing starts with 'Q' and the user starts by typing a 'q'? The list won't scroll at all. What would be nicer would be to scroll to the place where an item beginning with 'q' *would* be if there were one. ~~ Dan Shafer, Information Product Consultant and Author http://www.shafermedia.com Get my book, "Revolution: Software at the Speed of Thought" From http://www.shafermediastore.com/tech_main.html ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
RE: scrolling to a line
> > I've modified Xavier's modification of my modification of > > (somebody's??) code to search incrementally in a sorted list field. that was original code - not to boast but to say why there wasn't no arrowkey handling in it before. I also have on arrowkey handlers so I dont have to handle those. Same on altkeyup with page up or down, control arrowkeys, etc... ;) Depends how you set up the params of your field maybe... -- Here's a few more cool functions which windows implements which are not impractical when the case applies... If I keep pressing the same letter (since the start of filling the word), the line keeps going down until it reaches the last occurrence of the lines starting with that letter, then it starts back at the first line. The second one, if applicable, it jumps to the line starting with the next best choice before the missing line... That way you see it's missing. Beeping is annoying... I'd rather have the hilite flash or something quiet... But good suggestions. I'll see what comes up next time I touch it up ;) But bring on any solution you may have... Is 3 seconds too much? Should the lastuserkeys should be wiped if we press deletekey or esc? cheers Xavier http://monsieurx.com > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > J. Landman Gay > Sent: Sunday, November 13, 2005 20:00 > To: How to use Revolution > Subject: Re: scrolling to a line > > Charles Hartman wrote: > > I've modified Xavier's modification of my modification of > > (somebody's??) code to search incrementally in a sorted list field. > > Could it have been the one I posted about two years ago? I > sent this to the list: > > > local lUserKeys, lOldTicks > on keyDown whichKey -- select from keyboard >-- J. Landman Gay, 1990, modified for Revolution: 2003 >if (the selectedField is not "") or (charToNum(whichKey) > is among the > items of "28,29,30,31") -- arrow keys >then pass keyDown >if the ticks - lOldTicks > 60 then put "" into lUserKeys >put whichKey after lUserKeys >put return & fld "myField" & return into tListText >get lineoffset(cr&lUserKeys,tListText) >if it > 0 then set the hilitedline of fld "myField" to it >put the ticks into lOldTicks > end keyDown > > > But it doesn't solve one problem: suppose the user starts typing a > > string that doesn't appear in the list? > > The easiest thing would be to just add a beep in this case, but if I > have time today I'll see if I can rewrite it to accomodate. > > -- > Jacqueline Landman Gay | [EMAIL PROTECTED] > HyperActive Software | http://www.hyperactivesw.com > ___ > use-revolution mailing list > use-revolution@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage > your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: scrolling to a line
Charles Hartman wrote: I've modified Xavier's modification of my modification of (somebody's??) code to search incrementally in a sorted list field. Could it have been the one I posted about two years ago? I sent this to the list: local lUserKeys, lOldTicks on keyDown whichKey -- select from keyboard -- J. Landman Gay, 1990, modified for Revolution: 2003 if (the selectedField is not "") or (charToNum(whichKey) is among the items of "28,29,30,31") -- arrow keys then pass keyDown if the ticks - lOldTicks > 60 then put "" into lUserKeys put whichKey after lUserKeys put return & fld "myField" & return into tListText get lineoffset(cr&lUserKeys,tListText) if it > 0 then set the hilitedline of fld "myField" to it put the ticks into lOldTicks end keyDown But it doesn't solve one problem: suppose the user starts typing a > string that doesn't appear in the list? The easiest thing would be to just add a beep in this case, but if I have time today I'll see if I can rewrite it to accomodate. -- Jacqueline Landman Gay | [EMAIL PROTECTED] HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
RE: scrolling to a line
> > set the hilitedline of me to lo (0 works ok! ;) > > I don't think so, unless I'm being even denser than usual. If > there's no match at all, 'lo' will contain 0, so no scroll at all. I meant it unselects anything if you click in an empty line ;) can be handled how you want... for example if you keep the last selection in a script local local lastselection on mouseup if line is empty then set hilitedline of the field to lastselection else put the clickline into x if it's empty delete then line x -- ;) set the hilitedline of the field to x put x into lastselection etc... end Nice fields get quickly complicated ;) cheers Xavier ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: scrolling to a line
On Nov 13, 2005, at 12:47 PM, MisterX wrote: try select before line lo of me or something like that, no that don't work in list fields set the hilitedline of me to lo (0 works ok! ;) I don't think so, unless I'm being even denser than usual. If there's no match at all, 'lo' will contain 0, so no scroll at all. ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Hartman Sent: Sunday, November 13, 2005 17:08 To: How to use Revolution Subject: scrolling to a line I've modified Xavier's modification of my modification of (somebody's??) code to search incrementally in a sorted list field. (This version, unlike Xavier's, assumes the whole line in the field is the sorted item.) But it doesn't solve one problem: suppose the user starts typing a string that doesn't appear in the list? If the first few letters match something, this scrolls to pretty close. But suppose nothing starts with 'Q' and the user starts by typing a 'q'? The list won't scroll at all. What would be nicer would be to scroll to the place where an item beginning with 'q' *would* be if there were one. I've only thought about it for a few minutes, but it's already given me a headache. Any clues? local kTyped, lastKeyTime on keyUp theKey if lastKeyTime is empty or the seconds - lastKeyTime > 3 then put theKey into kTyped else put theKey after kTyped put the seconds into lastKeyTime put lineOffset(CR & kTyped, me) into lo if lo is not 0 then set the scroll of me to lo * the effective textHeight of me end keyUp Charles Hartman ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
RE: scrolling to a line
try select before line lo of me or something like that, no that don't work in list fields set the hilitedline of me to lo (0 works ok! ;) ;) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Charles Hartman > Sent: Sunday, November 13, 2005 17:08 > To: How to use Revolution > Subject: scrolling to a line > > I've modified Xavier's modification of my modification of > (somebody's??) code to search incrementally in a sorted list field. > (This version, unlike Xavier's, assumes the whole line in the > field is the sorted item.) > > But it doesn't solve one problem: suppose the user starts > typing a string that doesn't appear in the list? If the first > few letters match something, this scrolls to pretty close. > But suppose nothing starts with 'Q' and the user starts by > typing a 'q'? The list won't scroll at all. What would be > nicer would be to scroll to the place where an item beginning > with 'q' *would* be if there were one. I've only thought > about it for a few minutes, but it's already given me a > headache. Any clues? > > local kTyped, lastKeyTime > on keyUp theKey > if lastKeyTime is empty or the seconds - lastKeyTime > 3 > then put theKey into kTyped > else put theKey after kTyped > put the seconds into lastKeyTime > put lineOffset(CR & kTyped, me) into lo > if lo is not 0 > then set the scroll of me to lo * the effective > textHeight of me end keyUp > > Charles Hartman > ___ > use-revolution mailing list > use-revolution@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage > your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
scrolling to a line
I've modified Xavier's modification of my modification of (somebody's??) code to search incrementally in a sorted list field. (This version, unlike Xavier's, assumes the whole line in the field is the sorted item.) But it doesn't solve one problem: suppose the user starts typing a string that doesn't appear in the list? If the first few letters match something, this scrolls to pretty close. But suppose nothing starts with 'Q' and the user starts by typing a 'q'? The list won't scroll at all. What would be nicer would be to scroll to the place where an item beginning with 'q' *would* be if there were one. I've only thought about it for a few minutes, but it's already given me a headache. Any clues? local kTyped, lastKeyTime on keyUp theKey if lastKeyTime is empty or the seconds - lastKeyTime > 3 then put theKey into kTyped else put theKey after kTyped put the seconds into lastKeyTime put lineOffset(CR & kTyped, me) into lo if lo is not 0 then set the scroll of me to lo * the effective textHeight of me end keyUp Charles Hartman ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution