I tried creating a menuItem subclass for a simple ColorMenuItem that
creates the icon on the fly and when the ran the app in the IDe it
crashed... and I'm noy sure if it was picture format or that doing it
on the fly is not allowed...
Class ColorMI
Properties:
Prompt As String
theColor As Color
theIcon As Picture
New Methods:
Sub Enable(CurrentColor as Color)
theColor = CurrentColor
if theIcon = NIL then theicon = NewPicture(16,16,32)
Dim g as Graphics = theIcon.Graphics
g.ForeColor = CurrentColor
g.FillRect 0,0, g.Width, g.Height
g.ForeColor = &c000000
g.DrawRect 0,0, g.Width, g.Height
me.Icon = theIcon
me.Enabled = True
End Sub
Event Handler
Function Action() As Boolean
Dim C as Color = theColor
If SelectColor(c, Prompt) Then theColor = C
End Function
Then I added a new item to the edit menu:
EditColorTest as set it's super to ColorMI and unchecked autoenable
In the Default Window I added:
Event handlers:
Sub Open()
HasBackColor = true
End Sub
Sub EnableMenuItems()
EditColorTest.Enable(me.BackColor)
End Sub
Menuhandler:
Function EditColorTest() As Boolean
me.BackColor = EditColorTest.theColor
Return True
End Function
When i run the app the Debug App crashes with:
Date/Time: 2006-07-23 13:47:48.660 -0400
OS Version: 10.4.7 (Build 8J135)
Report Version: 4
Command: My Application.debug
Path: /Users/me/Desktop/REALbasic 2006 Release 3/My Application.debug
Parent: WindowServer [59]
Version: ()
PID: 397
Thread: 0
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000
Thread 0 Crashed:
0 com.apple.QD 0x917685a0
InternalSyncCGContextOriginWithPort + 144
1 com.apple.QD 0x91771e1c
InternalCreateOrResetCGContextForPort + 316
2 com.apple.QD 0x91771c3c QDBeginCGContext + 260
3 RBFramework 0x006825ac 0x4925c0 + 2031596
4 RBFramework 0x005df294 0x4925c0 + 1363156
5 main 0x00455cbc 0x405000 + 330940
6 main 0x00408fc0 ColorMI.Enable%%
o<ColorMI>c + 572
7 main 0x00406b00
Window1.Window1.#EnableMenuItems%%o<Window1> + 236
8 RBFramework 0x0053a644 0x4925c0 + 688260
9 RBFramework 0x0053c2c8 0x4925c0 + 695560
10 RBFramework 0x0053eb48 0x4925c0 + 705928
11 RBFramework 0x0053f5f0 0x4925c0 + 708656
12 RBFramework 0x0053ea78 0x4925c0 + 705720
13 RBFramework 0x0053c968 0x4925c0 + 697256
14 RBFramework 0x0053cc34 0x4925c0 + 697972
15 RBFramework 0x00539730 0x4925c0 + 684400
16 main 0x00415f84 0x405000 + 69508
17 main 0x004097cc Main + 152
18 main 0x004050a0 % main + 32
19 ...ple.CoreServices.CarbonCore 0x90be63cc CCFM_LaunchApplication
+ 488
20 LaunchCFMApp 0x0000249c main + 388 (crt.c:355)
21 LaunchCFMApp 0x00001b78 _start + 344 (crt.c:272)
22 LaunchCFMApp 0x00001a1c start + 60
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>