selected

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: selected

Post by Klaus » Fri Jul 25, 2014 3:29 pm

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

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: selected

Post by robm80 » Sat Jul 26, 2014 7:47 am

Unbelievable :!:
I select 3 items in Criteria:
sshot-08.jpg
sshot-08.jpg (14.23 KiB) Viewed 2352 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)

robm80
Posts: 161
Joined: Sat May 03, 2014 7:15 am

Re: selected

Post by robm80 » Mon Jul 28, 2014 3:38 pm

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

Post Reply