VirtualKeyboard not Show when focus Edit fields in Firemonkey project -
i have firemonkey multi device project in delphi 10 seattle user can screen @ start of app. here user needs fill in 2 fields. when click on edit fields virtual keyboard isn't shown. if skip screen @ start , call later virtual keyboard shown. done in same way too.
i found sort of solution: when click on edit fields call show virtualkeyboard myself. problem cursor isn't shown in edit field.
is there way place cursor myself? or know how solve virtual keyboard not showing problem in other way?
problem on both android , ios
in code below can see initial form create. problem when in connectfromprofile method actcreatenewprofileexecute called. there call new form. in form(tfrmprofile) virtual keyboard isn't shown. call form action , works fine.
procedure tfrmnocoredks.formcreate(sender: tobject); begin inherited; system.sysutils.formatsettings.shortdateformat := 'dd/mm/yyyy'; checkphone; connectfromprofile; if not assigned(fprofileaction) connectdatabase else lstdocuments.enabled := false; {$ifdef android} changecomboboxstyle; {$endif} end; procedure tfrmnocoredks.connectfromprofile; begin fdmprofileconnection := tdmconnection.create(nil); fdmprofileconnection.openprofiledb; fdmprofileconnection.loadprofiles; if fdmprofileconnection.profiles.count = 0 begin // createdefault profile fprofileaction := actcreatenewprofileexecute; end else if fdmprofileconnection.profiles.count = 1 begin // 1 profile load connection; fprofileaction := nil; fcurrentprofile := fdmprofileconnection.profiles.items[0]; end else begin // multiple profiles choose connection; fprofileaction := selectprofileonstartup; end; end; procedure tfrmnocoredks.formshow(sender: tobject); begin if assigned(fprofileaction) fprofileaction(self); end; procedure tfrmnocoredks.actcreatenewprofileexecute(sender: tobject); var profilename, databasename, pathname: string; prf: tfrmprofile; begin prf := tfrmprofile.create(nil); prf.data := fdmprofileconnection.profiles; prf.showmodal( procedure(modalresult: tmodalresult) begin if modalresult = mrok begin profilename := prf.edtprofilename.text; databasename := prf.edtdatabasename.text; {$ifdef ios} pathname := system.ioutils.tpath.getdocumentspath; {$endif} {$ifdef android} pathname := system.ioutils.tpath.getdocumentspath; {$endif} {$ifdef win32} pathname := extractfilepath(paramstr(0)) + '\data'; {$endif} fdsqlitebackup1.database := system.ioutils.tpath.combine(pathname, 'default.sqlite3'); // default database fdsqlitebackup1.destdatabase := system.ioutils.tpath.combine(pathname, databasename + '.sqlite3'); fdsqlitebackup1.backup; fdmprofileconnection.addprofile(databasename + '.sqlite3', profilename); fdmprofileconnection.loadprofiles; fcurrentprofile := fdmprofileconnection.profiles.items[0]; connectdatabase; end else application.terminate; end); end;
do not show additional forms in mainform.oncreate/onshow
. trying on ios 9.2 freeze app @ "launch screen".
instead of this, show new form asynchronously, this:
procedure tform4.formshow(sender: tobject); begin ttask.run(procedure begin tthread.synchronize(nil, procedure // work visual controls - throught synchronize or queue begin form5:=tform5.create(application); form5.showmodal; end) end); end;
of cource, can separate code external procedures:
procedure showmyform; begin form5:=tform5.create(application); form5.showmodal; end; procedure taskproc; begin tthread.synchronize(nil, showmyform); end; procedure tform4.formshow(sender: tobject); begin ttask.run(taskproc); end;
========
another way - not use additional forms. create frame , put (at runtime) on mainform align = contents
. after needed actions - hide or release (due arc dont forget set nil frame variable) frame.
Comments
Post a Comment