I really need some professional help here! :)
I have 2 buttons. They are working, but I am using a list and whenever there is a duplication in the list (same word) the button does not work properly (as the system does not realize that the second word is a different word, so that everything gets switched back to the first word).
Example:
list = {"time", "Snow", "mother", "queen", "stepmother", "magic", "day", "queen", "huntsman"}
I have a duplication of the word "queen" in the list. So that, when I am just on the second "queen" and I click "Next", I'll get "stepmother" and not "huntsman" because of the duplication of the word in the list.
Code:
DynamicModule[{},
Column[{
InputField[Dynamic[f], String, MenuList -> list,
Alignment -> {Left, Center}],
Button["Previous",
Dynamic[f =
list[[Max@{Position[list, f][[1, 1]] + 1,
Length@list}]]], Alignment -> {Right, Center},
ImageSize -> Automatic],
Button["Next",
Dynamic[f =
list[[Min@{Position[list, f][[1, 1]] + 1,
Length@list}]]], Alignment -> {Right, Center},
ImageSize -> Automatic]
}]]
Do you know any solution for this problem?
Thank you very much,
Fanni