[futurebasic] mfSuspend events and a little PS at the bottom

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1998 : Group Archive : Group : All Groups

From: exile71@... (Forrest Blanton)
Date: Fri, 1 May 1998 15:23:26 -0700
Hello.

I didn't pay much attention during the posts about these events, however I
don't think mfSuspend was mentioned, or maybe it was :-/. Anyways, I've
checked and for some reason my app is never getting a mfSuspend event when
switching to other apps. I have not checked if it's receiving the
mfClipboard and mfResume; I will check those latter tonight. I even tried
editing the SIZE resource in ResEdit so that it accepted suspend and resume
events and it still doesn't work. Any explanations?

Thank you in advance.

-Forrest Blanton

PS: Does anyone know how to modify the code below to place the icon in the
menu next to an item instead of in the menubar itself? (HIT CMD "." TO
QUIT)

RESOURCES "AddIconMenu.rsrc"
WINDOW OFF : WIDTH -2                             'standard
COMPILE 1,_macsBugLabels_strResource_dimmedVarsOnly
'
' typedef short IconTransformType
_svLarge1Bit        = 1
_svLarge4Bit        = 2
_svLarge8Bit        = 4
_svSmall1Bit        = &100
_svSmall4Bit        = &200
_svSmall8Bit        = &400
_svMini1Bit         = &10000
_svMini4Bit         = &20000
_svMini8Bit         = &40000
_svAllLargeData     = &FF
_svAllSmallData     = &FF00
_svAllMiniData      = &FF0000
_svAll1BitData      = _svLarge1Bit_svSmall1Bit_svMini1Bit
_svAll4BitData      = _svLarge4Bit_svSmall4Bit_svMini4Bit
_svAll8BitData      = _svLarge8Bit_svSmall8Bit_svMini8Bit
_svAllAvailableData = &FFFFFFFF

' alignment type values
_atNone             = 0
_atVerticalCenter   = 1
_atTop              = 2
_atBottom           = 3
_atHorizontalCenter = 4
_atAbsoluteCenter   = _atVerticalCenter_atHorizontalCenter
_atCenterTop        = _atTop_atHorizontalCenter
_atCenterBottom     = _atBottom_atHorizontalCenter
_atLeft             = 8
_atCenterLeft       = _atVerticalCenter_atLeft
_atTopLeft          = _atTop_atLeft
_atBottomLeft       = _atBottom_atLeft
_atRight            = &C
_atCenterRight      = _atVerticalCenter_atRight
_atTopRight         = _atTop_atRight
_atBottomRight      = _atBottom_atRight

' typedef short IconAlignmentType;

' /*  transform type values  */

_ttNone             = 0
_ttDisabled         = 1
_ttOffline          = 2
_ttOpen             = 3
_ttLabel1           = &0100
_ttLabel2           = &0200
_ttLabel3           = &0300
_ttLabel4           = &0400
_ttLabel5           = &0500
_ttLabel6           = &0600
_ttLabel7           = &0700
_ttSelected         = &4000
_ttSelectedDisabled = _ttSelected_ttDisabled
_ttSelectedOffline  = _ttSelected_ttOffline
_ttSelectedOpen     = _ttSelected_ttOpen

DIM menuHndl&
END GLOBALS
GOTO "Main"
'
'
'
'============================================================
CLEAR LOCAL MODE
DIM err
' FUNCTION GetIconSuite(VAR theIconSuite: Handle; theResID: INTEGER;
' selector: IconSelectorValue): OSErr;
' INLINE  $303C, $0501, $ABC9;
LOCAL FN GetIconSuite(@suiteHndl&, suiteID, selector&)
  '--------------------------------------------------------
  `
  `    SUBQ.L #2,sp                ;clear space for result
  `    MOVE.L ^suiteHndl&,-(sp)    ;handle
  `    MOVE.W ^suiteID,-(sp)       ;icon suite res ID
  `    MOVE.L ^selector&,-(sp)     ;selector
  `    DC.W $303C,$0501,$ABC9      ;trap number
  `    MOVE.W (sp)+,D0             ;add result of function to stack
  '`    EXT.L D0                   ;D0 equals true/false
  `
END FN = err
'
'
'============================================================
CLEAR LOCAL
DIM theMenu&
DIM theIcons&
DIM thePlace&
DIM theLong&
DIM OSErr
LOCAL FN AddIconMenu&(menuID, iconID, location)
  '--------------------------------------------------------
  theMenu& = FN GETMENU(menuID)
  OSErr = FN GetIconSuite(theIcons&,iconID,_svAllSmallData)
  POKE [theMenu&]+_menuData + 1, 1
  thePlace& = [theMenu&] + _menuData + 2
  theLong& = thePlace&
  & theLong&, theIcons&
  CALL INSERTMENU(theMenu&,location)
  CALL DRAWMENUBAR
END FN = theMenu&

"Main"
WINDOW 1, "Menu Test"
menuHndl& = FN AddIconMenu&(128, 129, 0)

DO
  HANDLEEVENTS
UNTIL 0