mobilecontrolcreate problem

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
petero
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 59
Joined: Sat Jan 20, 2007 4:09 am

mobilecontrolcreate problem

Post by petero » Thu Jul 19, 2018 10:07 pm

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

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: mobilecontrolcreate problem

Post by LiveCode_Panos » Thu Jul 19, 2018 10:42 pm

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
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 59
Joined: Sat Jan 20, 2007 4:09 am

petero

Post by petero » Fri Jul 20, 2018 1:59 am

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.

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: mobilecontrolcreate problem

Post by LiveCode_Panos » Fri Jul 20, 2018 9:24 am

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
--

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”