Page 2 of 2

Re: selected

Posted: Fri Jul 25, 2014 3:29 pm
by Klaus
Hi Rob,

in your script you do not empty the variable tNameList when neccessary!
That's why only the recept from the FIRST card of stack "recepten" will ever get found!

Change this:

Code: Select all

...
  repeat with i = 1 to tRnumber
    repeat with b = 1 to tBtnNumbers
      put line b of tOrgList into tBtnName
      if the hilite of button tBtnName of cd i of stack "recepten" = true then
        put tBtnName & cr after tNameList
      end if
    end repeat
    delete char -1 of tNameList
    if tNameList=tOrgList then
      put fld "titel" of card i of stack "recepten" & cr after tTempfield
    end if

    ## Need to put this outside of the IF THEN condition or its content will NEVER fit!
    put empty into tNamelist
    ## !!!!!

  end repeat
...
Tested and works, although your stack keeps crashing my livecode very often!?


Best

Klaus

Re: selected

Posted: Sat Jul 26, 2014 7:47 am
by robm80
Unbelievable :!:
I select 3 items in Criteria:
sshot-08.jpg
sshot-08.jpg (14.23 KiB) Viewed 2697 times
In the script (left red button) on line 9: repeat with i = 5 to tRnumber
If i=5 the right answer is given (this combination is found indeed on card 5 of the substack).
when i= 1 to 5, the answer is "not found".

I tested it for several combinations of Criteria. Always the answer was right,
when i is the number of the card. But as this is a search, I have no idea what the
number of the right card is: the combination has to find that card :!: :!:

When i select 1 item in Criteria the right cards are found imediately,
but for a combination, see above.

Can you make chocolate of it :?: (as we say here)

Re: selected

Posted: Mon Jul 28, 2014 3:38 pm
by robm80
I have examined the last script many times and I came to the conclusion:

It is clear now, that when more than 1 criterium is selected, it goes wrong on the line
"if the hilite of button tBtnName of cd i of stack "recepten" = true then".
When I see that a hilited button is not recognised, I ask the same button with the messagebox
and get the answer "true". With 1 criterium it runs perfectly :o
So Is it my bug or RunRev's :?: :)
Rob