Page 1 of 1
cardsize,find,field
Posted: Sun May 18, 2014 8:38 am
by robm80
3 questions:
1. is it possible to change the size of 1 card without resizing the whole stack.
2. with find I see a rectangle around the chosen word. How when there are more identical words and I want them all. No such as "find again"?
With the that word I want to do someting with it, f.i. asking position, linenumber, position of first and last char; How?
3. In a scrolling list field I want by pressing a key, the first line beginning with that char scrolls up. Possible?
Re: cardsize,find,field
Posted: Sun May 18, 2014 10:51 am
by jmburnod
Hi Rob
1. is it possible to change the size of 1 card without resizing the whole stack.
As far I know NO
2. with find I see a rectangle around the chosen word. How when there are more identical words and I want them all. No such as "find again"?
With the that word I want to do someting with it, f.i. asking position, linenumber, position of first and last char; How?
Yes. There is many ways to do that. I' cooking one and I'm coming back
3. In a scrolling list field I want by pressing a key, the first line beginning with that char scrolls up. Possible?
Yes. Here is one way to do it.
-- script cd
Code: Select all
on keyup pKey
put allFirstLetters(myField) into tallFirstLetters
put pKey & "," into tSearch
put lineoffset(tSearch,tallFirstLetters) into tNumLine
get fDeNumToScroll(myField,tNumLine)
set the hilitedlines of fld "myField" to item 2 of line tNumLine of tallFirstLetters
set the scroll of fld "myField" to fDeNumToScroll(myField,tNumLine)
end keyup
--•• return a list of each first letter with the number of the foundline
function allFirstLetters pNameField
put empty into rallFirstLetters
put fld pNameField into tContentFld
put 0 into tCount
repeat for each line tLine in tContentFld
add 1 to tCount
if char 1 of tLine is in rallFirstLetters then next repeat
put char 1 of tLine & "," & tCount & cr after rallFirstLetters
end repeat
delete char -1 of rallFirstLetters
return rallFirstLetters
end allFirstLetters
--•• return the destination scrollV of the fld
function fDeNumToScroll pNameField,pNum
put the effective textHeight of fld pNameField into tSec
put (pNum-1)* tSec into tScroll
return tScroll
end fDeNumToScroll
Best regards
Jean-Marc
Re: cardsize,find,field
Posted: Sun May 18, 2014 11:18 am
by robm80
Hello Jean-Marc
Rather complicated, but I'll study on it.
Thanks a lot
Rob
Re: cardsize,find,field
Posted: Sun May 18, 2014 11:47 am
by Klaus
Hi Rob,
robm80 wrote:Rather complicated...
well, you didn't ask for the BEEP command!
Best
Klaus
Re: cardsize,find,field
Posted: Sun May 18, 2014 12:19 pm
by jmburnod
Hi Rob,
In fact it doesn't work as expectd for me
Testing and cooking again is the way
The same for you second question
Code: Select all
-- Cd script
--Search all word contain a string in field "myField"
on debSearchString
ask "Search"
if it = empty then exit debSearchString
put it into pString
get getLinesWithString(pString, "myField")
put it into fld "fResult"
setStyleFoundLine it,"myField"
end debSearchString
on setStyleFoundLine pFoundLine,pNameField
set the textstyle of line 1 to -1 of fld pNameField to plain
repeat for each line tLine in pFoundLine
set the textstyle of line (item 2 of tLine) of fld pNameField to box
end repeat
end setStyleFoundLine
function getLinesWithString pString,pNameField -- return a list FoundWord,FoundLine
put empty into rgetLinesWithString
put fld pNameField into stringToSearch
put 0 into tCount
repeat for each word tWord in stringToSearch
add 1 to tCount
if pString is in tWord then
put tWord & "," & tCount & cr after rgetLinesWithString
end if
end repeat
delete char -1 of rgetLinesWithString
return rgetLinesWithString
end getLinesWithString
Best
Jean-Marc
Re: cardsize,find,field
Posted: Sun May 18, 2014 2:09 pm
by Klaus
Dag Rob,
robm80 wrote:1. is it possible to change the size of 1 card without resizing the whole stack.
no, the STACK sizes defines the CARD size, not vice versa!
Of course you can set the stack size to whatever you want "on opencard" and "reset" it again "on closecard"!
robm80 wrote:2. with find I see a rectangle around the chosen word. How when there are more identical words and I want them all. No such as "find again"?
With the that word I want to do someting with it, f.i. asking position, linenumber, position of first and last char; How?
Let's see, what Jean-Marc comes up with for dinner
robm80 wrote:3. In a scrolling list field I want by pressing a key, the first line beginning with that char scrolls up. Possible?
Put this into the list fields script:
Code: Select all
on keyUp tKey
put lineOffset(return & tKey, the text of me) into tLineOffset
set the scroll of me to tLineOffset * the effective textHeight of me
end keyUp
Best
Klaus
Re: cardsize,find,field
Posted: Mon May 19, 2014 4:54 am
by robm80
Gutenacht Klaus
on keyUp tKey
put lineOffset(return & tKey, the text of me) into tLineOffset
set the scroll of me to tLineOffset * the effective textHeight of me
end keyUp
1. hese 2 lines do exactly what I wanted, but I don't understand the script and how it is working: I know what lineoffset does, but "return & tKey, the text of me) " is to much for me. I suppose thst tKey is a variable,
but why it is called once? It gives a number between to keys that has some thing to do with the scroll. Why to multipky it with the the effective textHeight of me
2.I want to follow my scripts with the debugger and I read what was in the tutorials. Here is a discepancy between LC's message box and the mine, and pressing an intelligents button does nothing. Have a look:

- LC's
and

- mine
I see that no sufficient pictures are accepted, so read my search story under "search".
Thanks