Page 1 of 1

mobilecontrolcreate problem

Posted: Thu Jul 19, 2018 10:07 pm
by petero
Getting an execution error message with the following code. Can anyone help? Thank you in advance.
( execution error at line 153 (Handler: can't find handler) near "mobileControlCreate", char 1)


on addComment pQuestion,pComment -- param is full text of question line; pComment is empty for a new comment
if isMobile() and "usernote" is among the lines of mobileControls() then
mobileControlDelete "usernote"
end if
resizeNoteGrp
set the cCurQ of grc "usernote" to pQuestion
show grp "noteEntry"
put calcInputControlPadding(10) into tInputRect -- resize for margins

---------->mobileControlCreate "multiline","usernote"

mobileControlSet "usernote","rect", tInputRect -- the rect of grc "usernote"
mobileControlSet "usernote","opaque",false
mobileControlSet "usernote","fontsize",the effective textsize of fld "questionsList"
mobileControlSet "usernote","visible","true"
if the platform = "iPhone" then
mobileControlSet "usernote","backgroundcolor","255,255,255,0" -- transparent
end if
if pComment <> "" then
replace numToChar(11) with cr in pComment -- replace soft breaks with returns
mobileControlSet "usernote","text",pComment
end if
end addComment

Re: mobilecontrolcreate problem

Posted: Thu Jul 19, 2018 10:42 pm
by LiveCode_Panos
Hi petero,

The mobileControlCreate command is for mobile only, so it will throw this error on Desktop when this line is executed.

You'll have to do something like:

Code: Select all

if isMobile() then
   mobileControlCreate ...
end if
as you did previously with mobileControlDelete.

Best,
Panos
--

petero

Posted: Fri Jul 20, 2018 1:59 am
by petero
If developing on my desktop, what is the best way to test whether the field will actually scroll? It doesn't scroll in run mode. Will it scroll if I test in the simulator (maybe using arrow keys)? Do I have to deploy a test version to my device to test the scrolling? Thanks for you response, it was very helpful.

Re: mobilecontrolcreate problem

Posted: Fri Jul 20, 2018 9:24 am
by LiveCode_Panos
Yes, you will be able to test the scroll of the mobile field in the simulator. You can use the mouse (hold and drag) to scroll in the simulator.

You might find this lesson useful:

http://lessons.livecode.com/m/4069/l/94 ... ll-a-field

Best regards,
Panos
--