Article View: fj.sys.mac
Article #62659Re: [Programming] PopUpMenu Standard?
From: Nobu Toge
Date: Thu, 04 Feb 1993 01:45
Date: Thu, 04 Feb 1993 01:45
80 lines
3567 bytes
3567 bytes
$BF=!w(JKEK$B$G$9!%(J
> $B6yC+$5$s(J $B!w9-EgBg$$$o$/!<(J
>
> Key Code $B$+$iAjEv$9$k%-!<$NL>A0$rF@$k$K$O$I$N$h$&$K$7$?$i$h$$$N$G$7$g(J
> $B$&$+!)(J
Alphabetic/Kana/Numeric key $B$@$1$7$+Aj<j$K$7$J$/$FNI$$$N$J$i!$(J
KCHR resource $B$r5U0z$-$G$-$^$9!%(JMultilingual system $B$N2DG=@-$r9MN8(J
$B$7$F!$:#;H$C$F$$$k=j$N(JKCHR resource ID$B$rCN$k$K$O!$(J
kchrID = GetScript(GetEnvirons(smKeyScript), smScriptKeys);
myHandle = GetResource('KCHR',kchrID);
$B$H$7$^$9!J(JApple Q&A stack $B$h$j!K!%$G(J,
short myKey ; $BM?$($i$l$?(J keyCode
Str255 *chars ; $B7k2L(J
$B$H$7$^$9$H!$(J
HLock(myHandle); HUnlock $B$^$G$N4V$K(J mem mgr call $B$9$k$J$iI,MW!%(J
myPointer = *myHandle + 260 + myKey; myPointer $B$O(J Ptr $B%?%$%W(J
(*chars)[0] = 1;
(*chars)[1] = (short)(*myPointer) & 0xFF;
HUnlock(myHandle);
$B99$K!$(Jcommand / control / option / Fkey / arrows / Ten-keys
$B$bLLE]$r8+$k$H$-$K$O!$;d$NM}2r$G$O!$(JIM-1 $B$+!!(JV$B$N3($K=>$C$F<+J,$G(J
Table $B$r(Jhard-code $B$9$k$+!$(Jcustom resource $B$r:n$C$F!$(Jlook-up
table $B$r:n$k0J30L5$$$H;W$$$^$9!%!J;d$O$=$&$7$?!%!K(J
$B$D$.$K!$(J
> Dialog $B$NCf$N(J PopUpMenu $B$K$D$$$F(J.
> Dialog $B$K(J Shadow Box $B$rI=<($7$=$N1&C<$K2<8~$-$N;03Q7A$rCV$/$3$H$K$h$C(J
> $B$F(J, $B%"%$%F%`$,(J PopUpMenu $B$G$"$k$3$H$rCN$i$;$k$Y$-$G$"$k(J, $B$H(J, IM V $B$K$"(J
> $B$j$^$9(J. $B$3$N:](J, $B2<8~$-$N;03Q7A$rI=<($9$k$?$a$NI8=`E*$J<jB3$-$O$"$k$N$G(J
> $B$7$g$&$+(J.
$B?7(JInside Mac $B$N(JToolBox Essential$B$N4,$K!$(Jsys7$B$O(J $BLp0u(J built-in $B$N(J
popup menu CDEF $B$,Ds6!$5$l$F$k$+$i!$$=$l$r;H$$$J$5$$$H8@$C$F$$$^$9!%(J
$B>\:Y$O:#<j5v$K(JIM$B$,L5$$$N$G!$$o$+$j$^$;$s!J$4LH$J$5$$!K!%(JTN $B$N$I$l$+(J
$B$KF1Ey$N>pJs$,$"$k$+$b$7$l$^$;$s!%(J
$B$3$l$H$O$^$C$?$/JL$K!$(JDisinfectant $B$N(Jsource code $B$K!$;03Q$r<j$G=q$/(J
$B;~$N$d$jJ}$,=q$$$F$"$j$^$9!%;d$O$3$l$r<+J,MQ$K>/$7D>$7$F!J$H$$$C$F$b!$(J
$B$[$H$s$I(Jdead-copy!)$B;H$C$F$$$^$9!%(JControl item $B$N(J rect $B$H(Jlabel $B$r(J
$BM?$($?$H$-!$(Jpopup $B$U$&$N(J shadow $BIU$-;M3Q$H!$(Jlabel$B$H!$;03Q$r=q$/(J
proc $B$G$9!%(J
void DrawLabel( Rect *rPtr, Str255 s)
{
Rect tempRect,arrowRect;
short size;
PolyHandle triangle;
tempRect = *rPtr;
tempRect.bottom -= 1;
tempRect.right -= 1;
EraseRect( &tempRect );
FrameRect( &tempRect );
MoveTo( tempRect.left + 1, tempRect.bottom );
LineTo( tempRect.right, tempRect.bottom );
LineTo( tempRect.right, tempRect.top + 1 );
size = rPtr->right - rPtr->left - StringWidth(s);
MoveTo( rPtr->left + size/2 - 4, rPtr->bottom - 6);
DrawString(s);
triangle = OpenPoly();
MoveTo(rPtr->right - 17, (rPtr->top + rPtr->bottom - 5)>>1);
Line(10, 0);
Line(-5, 5);
Line(-5, -5);
ClosePoly();
PaintPoly(triangle);
KillPoly(triangle);
}
Technical Details
Message-ID:
<1993Feb4.014559.14200@kekux.kek.ac.jp>Path:
arc1-ca.pugleaf.net!sparky!uunet!ccut!news.u-tokyo.ac.jp!s.u-tokyo!kekux!togeReferences:
<SUMI.93Feb3184715@cuby.mis.hiroshima-u.ac.jp>Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: f514d,2b6d44c4cc0e0381 X-Google-Attributes: gidf514d,public X-Google-ArrivalTime: 1993-02-03 17:45:59 PST Newsgroups: fj.sys.mac Path: arc1-ca.pugleaf.net!sparky!uunet!ccut!news.u-tokyo.ac.jp!s.u-tokyo!kekux!toge From: toge@kekvax.kek.ac.jp (Nobu Toge) Subject: Re: [Programming] PopUpMenu Standard? Message-ID: <1993Feb4.014559.14200@kekux.kek.ac.jp> Sender: news@kekux.kek.ac.jp (USENET News System) Nntp-Posting-Host: 130.87.65.24 Organization: KEK X-Useragent: NewsAgent v1.42 References: <SUMI.93Feb3184715@cuby.mis.hiroshima-u.ac.jp> Distribution: fj Date: Thu, 4 Feb 1993 01:45:59 GMT Lines: 80