Test the app in my Ipad

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Mon Jan 19, 2015 10:02 am

Hi Dave,

Thanks for your answer...:-)

My keyboard is the normal one. So, i have no 'tab key'...
But i was using the option 'tab on return' in the property in the text field...:-)

I will try the code a little bit later...

Regards.

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Mon Jan 19, 2015 10:56 am

Hi,

it is me again...:-)

This is the code i have in the script of my text field ("Txt9"), that it should go to the next text field ("Txt10") when the user press the return / enter key:

Code: Select all

global TxtSel
global sFldH,sFldV

on returninfield
   goNextTarget
end returninfield

on tabinfield
   goNextTarget
end tabinfield

on enterinfield
   goNextTarget
end enterinfield

on goNextTarget
   focus on fld "Txt10" of grp "grpTxt10"
end goNextTarget

on focusIn
   put "grpTxt9" into TxtSel
   put item 1 of the loc of grp "grpTxt9" into sFldH
   put item 2 of the loc of grp "grpTxt9" into sFldV
end focusIn
And to can put the group 10 in the middle of the screen and don't be hidden by the keyboard i have this in the script of the text field 10:

Code: Select all


global TxtSel
global sFldH,sFldV

on focusIn
   put "grpTxt10" into TxtSel
   put item 1 of the loc of grp "grpTxt10" into sFldH
   put item 2 of the loc of grp "grpTxt10" into sFldV
end focusIn
But the field 10 is still hidden by the keyboard and i can't see if the focus is in this text field 10...

Is it correct this code?

Regards.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Mon Jan 19, 2015 1:52 pm

Hi aebki - have a look at the attached stack (I tweaked the example from the lesson to deal with 10 text fields) and see if it helps to clarify things...

Kind regards

Dave

EDIT: make sure you read the comments in the card script - also, I've tested it on my iPad but to build and test on your device remember to amend the internal app id and profile settings in the Standalone Application Settings dialog box
Attachments
Move Keyboard Example-2.livecode.zip
(4.69 KiB) Downloaded 226 times
"...this is not the code you are looking for..."

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Mon Jan 19, 2015 5:44 pm

Hi,

Thanks for your answer and for the example...:-)
I tested it in my Ipad and i see that is doing what i want...:-)

For the moment i didn't understand all the code but quite...:-)

So yes, now i see that i don't need to pass in the 'keyboardDesactivated' to change the location each time...

I wil try to apply to my code what i will learn...for the moment i only tried to use the method 'on openField' that you used in your code

I have two doubts:

The first one is why is not working the method 'on focusIn'...i put inside only one 'answer "method focus In"', but is not entering never...:-( this is normal?
And then in your code you have one 'on openField'...when should enter in this method? Because in what i tested it entered directly when the card was opened and i put it only in the script of the text field number 9...

Regards.

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Mon Jan 19, 2015 8:25 pm

It is me again...

I tried to understand your code and reading all what you commented too, but i am not able...:-(
My knowledge in LiveCode is not enough for the moment...:-(
But i hope it will improve soon that can understand the properties, behaviors, the pass, etc...:-)

So i am trying to do it in another way that will be easier for me to understand and to apply for the code i have in my cards...:-)
This is the code i have in one of the text fields ( in this case is the code of the text field number 9, as you can see with the answer i have inside )

Code: Select all

global TxtSel
global sFldH,sFldV

on returninfield
   goNextTarget
end returninfield

on tabinfield
   goNextTarget
end tabinfield

on enterinfield
   goNextTarget
end enterinfield

on goNextTarget
   set the loc of grp TxtSel to sFldH & comma & sFldV
   focus on fld "Txt10" of grp "grp10"
end goNextTarget

on openField
   answer "field number 10"
   put "grp9" into TxtSel
   put item 1 of the loc of grp "grp9" into sFldH
   put item 2 of the loc of grp "grp9" into sFldV
   put 528 into valueV
   put 383 into valueH
   set the loc of grp TxtSel to valueV & comma & valueH
end openField

And this is the code i have in my card script that concerns the keyboard:

Code: Select all

global TxtSel
global sFldH,sFldV

on keyboardActivated
      put 528 into valueV
      put 383 into valueH
      set the loc of grp TxtSel to valueV & comma & valueH
end keyboardActivated

on keyboardDeactivated
      set the loc of grp TxtSel to sFldH & comma & sFldV
end keyboardDeactivated

So with the code is working, when i have the answer in the openField

Code: Select all

   answer "field number 10"
But without this line (in each one of the fields ) is not working...:-(

Anyway, i am still not understanding why i can't use the event on focusIn, as i said in my last post...:-(

I am still thinking ( with my few knowledge in LiveCode) that it should work if the event 'on focusIn' is working when i am using 'focus on oneObject'...:-(

Regards.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Tue Jan 20, 2015 10:34 am

hi aebki

I think that it would be a shame if you turned away from the code in my example stack because you don't understand it - I should imagine you will develop more as a developer (and create a better app) if you can and treat exploring it as a learning opportunity and lesson designed especially for your situation

If you interrogate the code and then you come across a bit you don't understand, spend a bit of time in the dictionary, searching here in the forum and on Google and you will figure it out (you may well end up learning things you didn't expect to learn - but that is the joy of 'new stuff' and of becoming a developer). And if you really can't figure it out - ask!

Probably the most powerful weapon you can use while breaking down the barriers to understanding-what-is-going-on-in-code is DEBUGGING. It is often invaluable to put in a breakpoint (if you don't know how to do this then google it) so you can see what the code is doing line-by-line. For more on the essential skill of debugging see my posting in this thread http://forums.livecode.com/viewtopic.ph ... te#p100443

Another great way to find out what the code is doing is to use 'answer' and 'put' statements at various points in the code to report on what values are in different variables, or even using a simple 'Answer "line 234" will let you know during debugging whether a problematic hander reached a certain line number.

Actually you could use the above approaches to find out what is going on in your code without looking at my example - but if you had been using these approaches to coding/learning I'm not sure I would have needed to write it for you...

Kind regards

Dave
"...this is not the code you are looking for..."

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Tue Jan 20, 2015 11:31 am

Hi Dave,

Thanks for your answer...:-)

So i agree with you about Debugging and also about the 'answer' to see what the code is doing and from where is passing...
And this i am trying to use it, as i also tried to used the dictionary...:-)
Even with the dictionary, i didn't understand the instruction 'pass' for example...:-(
And i also found in the dictionary the 'on focusIn' and for this i tried to use it, but it is not working...:-(

Once again thanks a lot for the example you made for me...:-)

My intention, as you could see, was not to make one 'copy - paste' of what you did...first i tried to understand your code, and i really didn't understand a lot what you made (specially with the properties, behaviours, pass, etc...)
And then i tried to see which events you used and look in the dictionary what they make and try to apply it in my code...

So really i did my best to understand it, but i think that for the moment i am not able to assimilate all these new concepts...but of course that i would like to do it...
But all this, is new for me...and added to this i thought that i already finished my first app, but then when i passed it from desktop to mobile i had problems with the database, with the GUI, with the keyboard hidding some of my text fields, etc...

So i think i was in a hurry to finish my first app...because i am sure that after the inconvenience of the keyboard i will find more...:-(

I don't know if you still remember when you made your first app with LiveCode...me i am waiting impatient that this moment will arrive...:-)

Anyway i will go again in your example and read once again all the code and comments to see if today i am able to assimilate it better...:-)
And after this and the debugging i hope then i can do it for my app...:-)

Regards.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Tue Jan 20, 2015 11:40 pm

Hi aebki - I do indeed remember feeling frustrated at not being able to understand what were supposed to be answers to my questions (sometimes it seemed that my learning curve was in fact a vertical wall - and I was stuck at the bottom of it). So apologies if I was making you feel like this - but I really am just trying to help and the example code etc should benefit you if you spend a bit of time with it. It is difficult - I can see things in code and concepts-about-code that you might not - and you know your situation and can see obstacles to learning that I cannot. As long as we keep plugging away things will sort themselves out and we will progress :)

So, lets talk about 'pass', custom properties, and 'focusin'...

pass
Have you come across the LiveCode message path as a concept? (if not google it), what 'pass <handler name>' does is re-introduce the message back into the LiveCode message path. For example, the script of a button, a card and a stack might have a 'mouseup' handler each with an answer command saying something like "activated from the button". What would normally happen if a user clicked the button is that the 'mouseup' message would start to travel up from the button via the message path to the LiveCode engine. The first handler found in this path that matches the message name 'captures' the message and it is handled in that, um, handler. So in our example the handler in the button would fire and the message would stop there, never reaching the 'mouseup' handlers in the card or stack. If you placed a "pass mouseup" line of code below the 'Answer' command in the button's handler you would find that when the user clicked the button first he/she would get an 'Answer' message from the handler in the button, and then (because of the 'pass' command) he/she would see the 'Answer' message from the handler in the card 'mouseup' handler. And adding 'pass mouseup' to the handler in the card script would in turn allow the message to pass on to the handler in the stack script.

So when I wrote 'pass openField' in the field's 'openfield' handler I was allowing the message to continue travelling up the message path - why did I do this? I think at one stage I was thinking of making use of an 'openField' handler at the card level - in the end I didn't use it and should have deleted that line of code.

custom properties
Custom properties are attributes or properties of controls that you can set and use to store data. A button, a field, a card and a stack can have custom properties (as can other controls). So when I used

Code: Select all

 set the uCurrentFieldGroup of this stack to tID
in each field's 'openField' handler I was storing the value of 'tID' in the custom property (called 'uCurrentFieldGroup' of the stack. Instead of using this to store the value I could have used a field to store it or a global variable - I just happened to think that it's more elegant to store it in a custom property.

And when in the 'keyboardActived' handler in the card I use this line of code:

Code: Select all

   put the uCurrentFieldGroup of this stack into tID
I was extracting the value of the stack's custom property and putting it into tID (for use later in the handler).

focusin
I made use of 'openField' message which according to the LiveCode dictionary is quite similar to (but not exactly the same as) the 'focusin' message - by this I mean that if you search for 'focusin' in the dictionary you will see a link to 'openField' in the 'See also' section. I didn't try 'focusin' so can't say why it isn't working for you (after all it's not exactly the same as 'openfield') - my advice would be to use a message that works for you if you can't find any obvious bug in your code...

Does this help? Which other bits don't make sense to you?

Kind regards

Dave
"...this is not the code you are looking for..."

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Wed Jan 21, 2015 2:53 pm

Hi Dave,

Thanks for your mail...:-)

And sorry for my late answer...:-( I just saw your post now!
Since my last post, i was trying to understand all what you wrote and then to try to make it work...
I didn't manage to do it, even if i could learn more things...
Answering to your question, i have to say that now i understand the properties and the pass...So, once again thanks!!! :-)
Till now i was fixed in the pass instruction thinking that this was the instruction that what making it work...But now i deleted in your code and i could see that is working well anyway! :-)
And yes, finally yesterday i also understood why was openField and not focusIn...If i understood well, It could work with 'focusIn' if the field is locked...But for unlocked fields we have to use 'openField'...

As now i understood the properties and the pass (even this i don't need it), i will try to apply it for my app a little bit later...

Thanks a lot for your help and your patience!!! :-)

Regards.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Thu Jan 22, 2015 1:10 am

Hi aebki - fantastic news! Tell us how you get on - and good luck!

Kind regards

Dave
"...this is not the code you are looking for..."

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Fri Jan 23, 2015 11:14 am

Hi Dave,

Sorry for my late news...:-( I was busy these days!

Finally this morning i could find time to test the code, after you fantastic explanation, and it worked fine...:-)

Thanks a lot.

I will continue testing my app in the Ipad to see if everything is working as it should! :-)

Regards.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Fri Jan 23, 2015 11:24 am

Woohoo! :)
"...this is not the code you are looking for..."

trags3
Posts: 432
Joined: Wed Apr 09, 2014 1:58 am

Re: Test the app in my Ipad

Post by trags3 » Sat Jan 24, 2015 1:47 am

Dixie wrote:Hi...

It seems things have changed with xCode 6.1... under the heading 'Installed Apps' you will see a '+" sign... ...
Dixie, Where is the 'Installed Apps' heading?

Tom

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Test the app in my Ipad

Post by dave.kilroy » Sat Jan 24, 2015 10:41 am

Hi Tom - assuming you have Xcode 6.1.1 installed...

1 - connect your iPad/iPhone to your mac via USB
2 - open Xcode
3 - from the 'Windows' menu choose 'Devices'
4 - select your iOS device in the left-hand panel of the window that opens if not already selected

You should now see something like this screenshot listing apps installed by you via Xcode on the device. If you see no apps listed you haven't installed anything yet via Xcode...
Attachments
Screen Shot 2015-01-24 at 09.27.43.png
Screen Shot 2015-01-24 at 09.27.43.png (19.2 KiB) Viewed 9309 times
"...this is not the code you are looking for..."

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Test the app in my Ipad

Post by aebki » Sun Jan 25, 2015 11:16 pm

Hi,

It is me again...:-)

I am trying to make more 'pretty' and more 'friendly' my app that i ma testing in my iPad.
And for this i need to scroll in on card, which size is 1024 x 1536, moving 'the fingers' on the screen to can go to the bottom or to the top, depending of what the user needs.

But i didn't manage...:-(

So i decided to create on new and more simple project to test this:
And in this new project i have only the main stack with:
one button "btn1" in the location: 151, 563
one button "btn2" in the location: 151, 1423
and one group of these two buttons named "grpBtn"

Code: Select all

on preOpenStack
      
   if the environment is "mobile" then
      put "portrait,portrait upside down,landscape left,landscape right" into theallowed
      iphoneSetAllowedOrientations theallowed
   end if
   
   set the fullscreenmode of this stack to empty
   makeTheGroup
   set the layerMode of group "grpBtn" to "scrolling"
   if the platform is "iphone" then          
      set the compositorType of this stack to "opengl"
   else
      set the compositorType of this stack to "software"
   end if
   set the compositorTileSize of this stack to 32
   set the compositorCacheLimit of this stack to (16 * 1024 * 1024)
end preOpenStack

on makeTheGroup
   if exists(group "grpBtn") then
   else
      group button "btn1" and button "btn2"
      set the name of last group to "grpBtn"
   end if
end makeTheGroup

and inside the script of the group, i have this code:

Code: Select all

local sScrolling
local sInitialMouseX, sInitialMouseY
local sInitialHScroll, sInitialVScroll

on mouseDown
   ## Allow the group to scroll
   put true into sScrolling
   
   ## Record the initial touch position
   put item 1 of the mouseLoc into sInitialMouseX
   put item 2 of the mouseLoc into sInitialMouseY
   
   ## Record the initial hScroll and vScroll
   put the vScroll of me into sInitialVScroll
   put the hScroll of me into sInitialHScroll
end mouseDown

on mouseMove mouseX, mouseY
   ## If the screen is being touched then
   if sScrolling then      
      ## Calculate how far the touch has moved since it started
      put mouseY - sInitialMouseY into tVChange
      put mouseX- sInitialMouseX into tHChange
      
      ## Reset the hScroll and vScroll to follow the touch
      lock screen
      set the vScroll of me to sInitialVScroll - tVChange
      set the hScroll of me to sInitialHScroll - tHChange
      unlock screen
   end if
end mouseMove

on mouseRelease
   mouseUp
end mouseRelease

on mouseUp
   put false into sScrolling
end mouseUp
But even in this sample stack is not working...:-(
In fact i am seeing only the button "btn1"...:-(

Do you know why?

Regards.

Post Reply