I have this piece of code:
static void Retorno(){
   FieldPtr    fldEntrPtr;
   FormPtr     form;
   FormPtr     previousForm = FrmGetActiveForm();
   
   form = FrmInitForm(frmRetornoNum);  
   //FrmSetActiveForm(form);             
   FrmDrawForm(form);
   FrmSetFocus(form,fldEntrada);
   FrmDoDialog(form);                  
   fldEntrPtr=FrmGetObjectPtr(form,FrmGetObjectInde(form,fldEntrada));
   if(FldGetTextPtr(fldEntrPtr)){      //se string nao
vazia..
      StrCopy(tempString,FldGetTextPtr(fldEntrPtr
   }
   FrmDeleteForm(form);                //deleta o novo
form..
   FrmSetActiveForm(previousForm);     //torna o antigo form
o ativo
    
}

But I couldnt be able to do it work, it doesnt matter the
order of the APIs. Or it cracks or it doesnt put the
cursor...

On Thu, 05 Apr 2001 08:29:27 -0700
 Neil Rhodes <[EMAIL PROTECTED]> wrote:
> To set the focus, use FrmSetFocus. Prior to OS 3.5, this
> call had to be done
> *after* the first call to FrmDrawForm, but in 3.5 and
> later, can be done
> earlier.
> 
> For a modal dialog, to handle the pre-3.5 case, you need
> an explicit call to
> FrmDrawForm, after which you can set the focus:
> 
> FrmDrawForm(frmP)
> FrmSetFocus(frmP, desiredIndex)
> FrmDoDialog(frmP);
> 
> > 
> > I had the same problem. Being new to Palm, I'm not sure
> about FldDrawField
> > with a modal, nor about freeing a field's text handle
> myself. The following
> > works for me with only a slight problem in that I have
> several fields on my
> > modal form, would like to set the focus to one in
> particular, but can't
> > figure out how. Here goes:
> > 
> > 
> > frmP=FrmInitForm(Mailbox_Form);
> > 
> > objIndex=FrmGetObjectIndex(frmP, Mailbox_User_Field);
> > fldP=FrmGetObjectPtr(frmP, objIndex);
> > FldFreeMemory(fldP);
> > fldH=MemHandleNew(FldGetMaxChars(fldP)+1);
> > txtP=(CharPtr)MemHandleLock((VoidHand)fldH);
> > StrCopy(txtP, globalmailboxuserid);
> > MemHandleUnlock((VoidHand)fldH);
> > FldSetTextHandle(fldP, fldH);
> > 
> > buttonID=FrmDoDialog(frmP);
> > 
> > if (buttonID != Mailbox_Cancel_Button){
> > objIndex=FrmGetObjectIndex(frmP, Mailbox_Userid_Field);
> > fldP=FrmGetObjectPtr(frmP, objIndex);
> > fldH=FldGetTextHandle(fldP);
> > txtP=MemHandleLock(fldH);
> > StrCopy(globalmailboxuserid, txtP);
> > MemHandleUnlock(fldH);
> > }//endif buttonID
> > 
> > FrmDeleteForm(frmP);
> > 
> > I've resigned myself to the fact that I cant set the
> focus, but only just
> > because that form is rarely used.
> 
> 
> -- 
> Neil Rhodes     
> [EMAIL PROTECTED]            Available for contract
> programming
> Coauthor: Palm Programming: the Developer's Guide
> (O'Reilly)
> 
> 
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/

________________________________________________
Don't E-Mail, ZipMail! http://www.zipmail.com/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to