Hello
I have several inquiries and would be really thankful If someone helps me
with that:
1- I have a photo, jpeg format, 1024*768, 24 bit depth, and then I
convert this with ACDSee to 160*120, 16 bit depth. Then for adding it to a
bitmap resource I just copy the pixels and then paste them in the form
resource, but when I copy it, it reduces to 256 colors in the bitmap
resource, my I know why? I still want it to be 16 bit! Can we change to 16
bit in constructor or is there a function in the OS that takes care of this?
2- I have a code as shown below:
static Boolean AppHandleEvent(EventPtr event)
{
UInt16 formId;
FormPtr form;
if ( event->eType == frmLoadEvent) {
//Load the form resource.
formId = event->data.frmLoad.formID;
form = FrmInitForm(formId);
ErrFatalDisplayIf(!form, "Can't initialize form");
FrmSetActiveForm(form);
switch (formId) {
case 1300:
FrmSetEventHandler(form,
MenuFormHandleEvent);
break;
case MainForm:
FrmSetEventHandler(form,
MainFormHandleEvent);
break;
}
return true;
} else
return false;
}
Boolean MenuFormHandleEvent(EventPtr event)
{
Boolean handled = false;
FormPtr form;
ControlType *graphic;
ScrollBarType *scroll;
switch (event->eType)
{ ...
...
case frmOpenEvent:
form = FrmGetActiveForm();
MenuFormInit(form);
FrmDrawForm(form);
handled = true;
break;
case sclRepeatEvent:
form = FrmGetActiveForm();
scroll =
FrmGetObjectPtr(form,FrmGetObjectIndex(form,MenuScrollbarScrollBar));
SclGetScrollBar (scroll,
&value1,&value2,&value3,&value4);
graphic =
FrmGetObjectPtr(form,FrmGetObjectIndex(form,MenuUnnamed1302GraphicButton));
if ( value1 == 1 )
CtlSetGraphics ( graphic, 1400,1400);
else
CtlSetGraphics ( graphic, 1100,1100);
handled = false;
break;
}
case frmCloseEvent:
MenuFormDeinit(FrmGetActiveForm());
handled = false;
break;
default:
break;
}
return handled;
}
2.1 Now in the first part of the code (AppHandleEvent) in the switch
function there are two cases, one is 1300 and the other one is MainForm, now
the 1300 can be replaced by MenuForm which is defined in my resource header
file, but when ever I write MenuForm instead of 1300 the compiler gives an
error and says: undefined identifier "MenuForm"!!, I don't know why, I have
this problem in several parts of my program, which I should replace them by
indexes!!
2.2 In the second part of the code (MenuFormHandleEvent), I have defined
Boolean variable called handled for returning the result of the function. I
know that when I get an event and interpret it, then I should set this
Boolean value, what confuses me is that when I should set it to false and
when to true!
For example in the case of frmOpenEvent it is set true, and in the case of
sclRepeatEvent and frmCloseEvent It should be set false, why? And then I
found out if I set the handled variable in sclReapeatEvent to ture, then the
scroll bar in the program will stop after it is pulled up or down!
Best Regards
Mohammad Afshari
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/