|
In new:
There is no sense calling CoerceMethod(cl, obj, OM_DISPOSE); when obj
== NULL becase object is already completely disposed.. You should use
CoerceMethodA() there, if your custom initialization failed AFTER calling
DoSuperNewA() but when it SUCCEEDED (when obj != NULL)..
In dispose & cleanup:
/* */ return(DoSuperMethodA(cl, obj)); *WRONG* You should pass msg too! i.e. return(DoSuperMethodA(cl,
obj,msg));
And thing which is very often ignored by MUI programming people (the most
of people writing here their example codes and other places on the net), but
doesn't cause crashes or other bad things, you don't check whether MUI window
was really opened after using set( win, MUIA_Window_Open, TRUE ); it should
be:
set( win, MUIA_Window_Open, TRUE );
if( xget( win, MUIA_Window_Open ) )
{
[ ... ]
}
otherwise if window can't be opened for various of
reasons application will not quit nicely!
/* set some text */ data = "" win); if(data) { data->buffer = AllocVec(255, MEMF_ANY|MEMF_CLEAR); if(data->buffer) sprintf(data->buffer, "Simple MUI Custom Class Test"); } instance data is always available if 2nd argument is not NULL, because it's
simple adding value to value.. No need to checking whether it's not NULL here..
:)
Best Regards!
|
- [MUI] Correct Custom Class Usage Daniel Allsopp
- Re: [MUI] Correct Custom Class Usage Sensei
- Re: [MUI] Correct Custom Class Usage Ilkka Lehtoranta
- Re: [MUI] Correct Custom Class Usage Sensei
- Re: [MUI] Correct Custom Class Usage Henning Thielemann
- [MUI] Re: Correct Custom Class Usage Christian Rosentreter
- Re: [MUI] Re: Correct Custom Class Usag... Henning Thielemann
- Re: [MUI] Re: Correct Custom Class Usag... Sensei
- Re: [MUI] Re: Correct Custom Class Usag... Ilkka Lehtoranta
- Re: [MUI] Correct Custom Class Usage Sensei
- Re: [MUI] Correct Custom Class Usage Henning Thielemann
