Setting up an Option Menu Button

Peter Haworth pete at lcsql.com
Thu Mar 13 11:34:59 EDT 2014


If the menu history of the button is already 1, no menuPick will be
generated. Try setting the menu History to zero then 1.

Pete
lcSQL Software
On Mar 13, 2014 4:40 AM, "Terence Heaford" <t.heaford at btinternet.com> wrote:

> I have an Option Menu on a card accessed from other cards where I want to
> select item 1 of the menu whenever you go to the card.
>
> The Card that owns Option Menu Button is also accessed from a Tab Panel.
>
> I have this script that is used to setup the button and sometimes it works
> and other times it doesn't.
>
> When I say doesn't, the ellipsis are not added.
>
> Can someone point me in the right direction please:
>
> --------
> This is the Tab Panel Script
> --------
> on menuPick pItemName
>    switch pItemName
>       case "General"
>          go to cd "ChartGeneral"
>          break
>       case "Categories"
>          go to cd "ChartCategories"
>          break
>       case "5 Year Categories"
>          go to cd "Chart5YearCategories"
>          put revDataFromQuery(tab, return, the uDB of stack "MyStack",
> "select categoryName from 'categoryList' order by categoryName asc") into
> tCatNames
>          set the text of cd btn "CategoryMenu" to tCatNames
>          --send "menuPick " & line 1 of tCatNames to cd btn "CategoryMenu"
>          dispatch "menuPick" to cd btn "CategoryMenu" of cd
> "Chart5YearCategories" with line 1 of tCatNames
>          set the menuHistory of cd btn "CategoryMenu" to 1
>          break
>    end switch
> end menuPick
>
> --------
> This is the Option Menu Script
> --------
> on menuPick pItemName
>    lock screen
>    addEllipsis the long name of me,pItemName
>    unlock screen
> end menuPick
>
> --------
> The following method is in the stack script to make it available to other
> menu's elsewhere.
> --------
> on addEllipsis pName,pChoice
>    lock screen
>    put the width of pName - 15 into tW
>    set the label of pName to pChoice
>    put the formattedWidth of pName into tSize
>    if tSize > tW then
>       repeat with x = length(pChoice) down to 1
>          set the label of pName to (char 1 to x of pChoice) & "..."
>          if the formattedWidth of pName < tW then
>             exit repeat
>          else
>             put x-1 into tMax
>             put char 1 to tMax of pChoice & "..." into tLabel
>          end if
>       end repeat
>       set the label of pName to tLabel
>    end if
>    unlock screen
> end addEllipsis
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list