[futurebasic] Re: [FB] getting a meaningful number from a font pop-up

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2002 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Thu, 24 Jan 2002 15:15:02 -0500
>ok, i've got a font menu in a pop-up (sorted alphabetically), and
>when it's used, i get the number of the menu-item that was chosen.
>(so the first alphabetical item on the list returns "1" when chosen.)
>
>now how do i translate _that_ number into
>the number i would use in a "text" statement?
>
>-bowerbird


Hooray! Something I can help with.

Use some version of the below.

GETFNUM is not recommended in Carbon. Nice people that they are, they don't
tell you what is though.

I call this from the doMenu FN

LOCAL FN MenuFont (ItemID)
DIM MenuH as handle
DIM FontName$
// gText.font is a record I have.
MenuH = FN GETMHANDLE(_FontPopup)
GETITEM (MenuH,ItemID,FontName$)$ // name of item gathered here
GETFNUM (FontName$, gText.font) // but you need the number for the TEXT
statement
Def CheckOneitem(_FontPopup,itemID) // check it
FN SetStyle(wnd) // this is my own custom FN.
END FN


Then use like

TEXT gText.font, gText.size, gText.style  // I have 2 popups plus some
checkbox buttons