Ask a Question related to Mac Programming, Design and Development.
-
Mike H. #1
Modal dialog Filters under X?
I've been trying to write a ModalDialog filter under OSX.
The reason is that I need to create an external code for InstallerVISE that
will operate under Carbon.
I tried copying the code I had used under Classic, and I got it to compile,
but it just crashes when I do anything with filters. I went to the Carbon
documentation, and it defines a ModalFilter as being:
Boolean MyModalFilterProc ( DialogRef theDialog, EventRecord * theEvent,
DialogItemIndex * itemHit
);
However, I had it defined as:
pascal Boolean MyModalFilterProc (DialogPtr theDialog, EventRecord
*theEvent, short * itemHit)
If I try compiling without the pascal definition, it doesn't work.
Are the Apple docs wrong? This code is impossible to debug because it's
being compiled as a code resource for InstallerVISE...any help would be
greatly appreciated.
My code crashes at the end of this section (I figured this out through
System Beeps):
ModalFilterUPP MyFilterUPP;
SysBeep(88);
MyFilterUPP = NewModalFilterUPP(MyFilter);
Where MyFilter is defined as:
pascal Boolean MyFilter(DialogPtr dlog, EventRecord *evt, short *itemHit)
Thanks!
Mike H.
Mike H. Guest
-
Parent window for modal dialog
What is the best way to get a parent window for a modal dialog? Currently, I am using the following code: HWND hParent =... -
problem with non modal ADM dialog
How do you get the first parameter for sADMDialog->Modal, sADMPluginRef. I have been struggling for a while. Thank you in advance. -
Modal Dialog
Hi <base target="_self"> Or place a iframe in the dialog and host the page there -- Best Regards Vidar Petursson... -
Modal Dialog Popup from WebControl - What is wrong with this...
http://www.aspfaq.com/show.asp?id=2257 "Jim Mitchell" <jim_mitchell@mindspring.com> wrote in message... -
Submit form from modal dialog
Hi, I have a web page that opens a modal dialog (client side) in the following manner ... -
Tom Dowdy #2
Re: Modal dialog Filters under X?
In article <BB97C8E0.28727%nospam@endspam.org>,
"Mike H." <nospam@endspam.org> wrote:I am skeptical that it is crashing in the call to NewModalFilterUPP> My code crashes at the end of this section (I figured this out through
> System Beeps):
>
> ModalFilterUPP MyFilterUPP;
>
> SysBeep(88);
>
> MyFilterUPP = NewModalFilterUPP(MyFilter);
unless your heap is already toast. If this is the case, something else
in your application is corrupting memory.
Far more likely you are crashing in your filter proc itself. Since you
don't enclose that code, it's basically impossible to say what could be
in error there.
However, two pretty good guesses are:
a) you are calling SetPort((GrafPtr)theDialog) instead of
SetPortDialogPort(theDialog)
b) in response to a window event (such as update or activate) you are
calling SetPort((GrafPtr)theEvent->message) instead of
SetPortWindowPort((WindowPtr)theEvent->message).
You might also consider using gdb, which should allow you to attach to
Vise. Run until the crash and get a backtrace. At the very least
you'll know what Toolbox call you are making which is crashing.
I know gdb isn't as sexy as Metrowerks, but it does have its place and
it's worth learning to use it.
Tom Dowdy Guest
-
Mike H. #3
Re: Modal dialog Filters under X?
You were right on the money---I removed those calls and I got it to not
crash anymore. It still isn't exactly working correctly, though---do you
know if there's any sample source for displaying a dialog (with a dialog
filter) in Carbon?
Thanks,
Mike Hunson
in article [email]dowdy-63A55F.06323625092003@news.apple.com[/email], Tom Dowdy at
[email]dowdy@apple.com[/email] wrote on 9/25/03 9:32 AM:
> In article <BB97C8E0.28727%nospam@endspam.org>,
> "Mike H." <nospam@endspam.org> wrote:>>> My code crashes at the end of this section (I figured this out through
>> System Beeps):
>>
>> ModalFilterUPP MyFilterUPP;
>>
>> SysBeep(88);
>>
>> MyFilterUPP = NewModalFilterUPP(MyFilter);
> I am skeptical that it is crashing in the call to NewModalFilterUPP
> unless your heap is already toast. If this is the case, something else
> in your application is corrupting memory.
>
> Far more likely you are crashing in your filter proc itself. Since you
> don't enclose that code, it's basically impossible to say what could be
> in error there.
>
> However, two pretty good guesses are:
> a) you are calling SetPort((GrafPtr)theDialog) instead of
> SetPortDialogPort(theDialog)
> b) in response to a window event (such as update or activate) you are
> calling SetPort((GrafPtr)theEvent->message) instead of
> SetPortWindowPort((WindowPtr)theEvent->message).
>
> You might also consider using gdb, which should allow you to attach to
> Vise. Run until the crash and get a backtrace. At the very least
> you'll know what Toolbox call you are making which is crashing.
>
> I know gdb isn't as sexy as Metrowerks, but it does have its place and
> it's worth learning to use it.
Mike H. Guest
-
Tom Dowdy #4
Re: Modal dialog Filters under X?
In article <BB987BA0.28794%nospam@endspam.org>,
"Mike H." <nospam@endspam.org> wrote:
Maybe because you removed things that were required for it to work...I> You were right on the money---I removed those calls and I got it to not
> crash anymore. It still isn't exactly working correctly, though---do you
> know if there's any sample source for displaying a dialog (with a dialog
> filter) in Carbon?
did not recommend removing "those calls" I recommended changing them to
the correct Carbon replacements.
I recommend debugging your code. Move the code into a standalone
application and debug it there if you are unwilling to learn gdb.
Tom Dowdy Guest



Reply With Quote

