How to get a text field to resize properly...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 223
- Joined: Wed Jun 21, 2006 7:33 pm
- Contact:
How to get a text field to resize properly...
...when the iOS device is rotated?
I've been reading that the geometry manager doesn't work in iOS yet. Any workarounds?
Also: What sort of field should I drop into a stack so that it would provide iOS-native appearance when scrolling? I imagine this would have to be a locked field so touching it (during runtime on the iOS device) wouldn't bring up the keyboard.
Any advice is welcome.
Thanks,
Barry
I've been reading that the geometry manager doesn't work in iOS yet. Any workarounds?
Also: What sort of field should I drop into a stack so that it would provide iOS-native appearance when scrolling? I imagine this would have to be a locked field so touching it (during runtime on the iOS device) wouldn't bring up the keyboard.
Any advice is welcome.
Thanks,
Barry
Re: How to get a text field to resize properly...
Hi Barry,
That is what you are looking for.
Sorry, did not work with this yet, so I cannot gibe any hints on how to do this.
But there is an example stack, select Menu: Help: Example Stacks and resources
This will open the appropriate folder and in its subfolder "Mobile Examples" you will find a stack "Scroller Example.livecode".
Open it and check the scripts.
Best
Klaus
since the current card will receive a "resizestack" message in that case, you can (need to!)write your own resize handlers.rumplestiltskin wrote:...when the iOS device is rotated?
I've been reading that the geometry manager doesn't work in iOS yet. Any workarounds?
Check the "iOS Rlease Notes" for "Scroller control – UIScrollView".rumplestiltskin wrote:Also: What sort of field should I drop into a stack so that it would provide iOS-native appearance when scrolling?
I imagine this would have to be a locked field so touching it (during runtime on the iOS device) wouldn't bring up the keyboard.
That is what you are looking for.
Sorry, did not work with this yet, so I cannot gibe any hints on how to do this.
But there is an example stack, select Menu: Help: Example Stacks and resources
This will open the appropriate folder and in its subfolder "Mobile Examples" you will find a stack "Scroller Example.livecode".
Open it and check the scripts.
Yes.rumplestiltskin wrote:I imagine this would have to be a locked field so touching it (during runtime on the iOS device) wouldn't bring up the keyboard.

Best
Klaus
-
- Posts: 223
- Joined: Wed Jun 21, 2006 7:33 pm
- Contact:
Re: UIScrollView
I just read the notes on UIScrollView. There's something missing:
1. How does one actually create such a control in LiveCode? It's not listed in the Objects>New Control menu.
2. Does it get grouped to a scrolling textfield that has had its vertical scrollbar disabled in the Property Inspector?
Thanks,
Barry
1. How does one actually create such a control in LiveCode? It's not listed in the Objects>New Control menu.
2. Does it get grouped to a scrolling textfield that has had its vertical scrollbar disabled in the Property Inspector?
Thanks,
Barry
Re: How to get a text field to resize properly...
Hi Barry,
1. only via script!
2. yes.
Check the "scroller" example I mentioned in my last posting.
Best
Klaus
1. only via script!
2. yes.
Check the "scroller" example I mentioned in my last posting.
Best
Klaus
-
- Posts: 223
- Joined: Wed Jun 21, 2006 7:33 pm
- Contact:
Re: How to get a text field to resize properly...
Klaus,
Thanks for your help. I've been working with the MobGUI pallete that "splash21" posted on his website:
http://www.splash21.com/MobGUI/
I've actually managed to get a scrolling text field working but it looks like I have to programmatically set the height of the field based upon the height of the total amount of text I put into that field during runtime; otherwise, a too-short field cuts off the text and a too-long field scrolls past the end of the text to the physical end of the field. I seem to recall there's a way of determining the total height by querying a couple of properties.
Barry
Thanks for your help. I've been working with the MobGUI pallete that "splash21" posted on his website:
http://www.splash21.com/MobGUI/
I've actually managed to get a scrolling text field working but it looks like I have to programmatically set the height of the field based upon the height of the total amount of text I put into that field during runtime; otherwise, a too-short field cuts off the text and a too-long field scrolls past the end of the text to the physical end of the field. I seem to recall there's a way of determining the total height by querying a couple of properties.
Barry
Re: How to get a text field to resize properly...
Hi Barry,
you need to set the height of the field to its "formattedheight"
Check "formattedXYZ" in the dicitonary.
Best
Klaus
you need to set the height of the field to its "formattedheight"

Check "formattedXYZ" in the dicitonary.
Best
Klaus
-
- Posts: 223
- Joined: Wed Jun 21, 2006 7:33 pm
- Contact:
Re: How to get a text field to resize properly...
Perfect! Just two or three lines of code and I can alter the height as req'd.
Thanks very much for your guidance. I'll have to post an example later today when I get a chance to do some coding.
Barry
Thanks very much for your guidance. I'll have to post an example later today when I get a chance to do some coding.
Barry
Re: How to get a text field to resize properly...
Hi Barry,
my pleasure
Best from germany
Klaus
my pleasure

Best from germany
Klaus
-
- Posts: 223
- Joined: Wed Jun 21, 2006 7:33 pm
- Contact:
Re: How to get a text field to resize properly...
Well, I've got the text field to re-size itself automatically depending on the amount of text (using the formattedHeight property); however, I seem to be having a bit of difficulty with the "orientationChanged" message. I've got an "on orientationChanged" handler in the card script that is supposed to change the width of the scrolling field to match the width of the scroller (the scroller width changes automatically - I'm using MobGUI):
Perhaps I'm misunderstanding the nature of the message (or maybe MobGUI is intercepting it somewhere).
Code: Select all
on orientationChanged
put the rect of group "Scroller-1006" into theCorners
set the rect of field "field 1" to (item 1 of theCorners,item 2 of theCorners, item 3 of theCorners, the formattedHeight of field "field 1")
end orientationChanged
Re: How to get a text field to resize properly...
Hi rumplestiltskin,
did you read this carefully?
From the "iOS Release Notes":
-------------------------------------------------------
Orientation changed notification
An application will receive an orientationChanged message if the device detects a change in its position relative to the ground,
and you can use the iphoneDeviceOrientation() function to find out the current orientation.
This message is sent to the current card of the default stack.
The orientationChanged message is sent before any automatic interface rotation takes place thus changes to the orientation
lock state and allowed set can be made at this point and still have an effect.
If you wish to perform an action after the interface has been rotated, then either do so on receipt of resizeStack,
or by using a send in 0 millisecs message.
-------------------------------------------------------
Looks like you re-size your objects just too early?
Try to change "orientationchanged" with "resizestack", maybe that will be enough.
Best
Klaus
did you read this carefully?
From the "iOS Release Notes":
-------------------------------------------------------
Orientation changed notification
An application will receive an orientationChanged message if the device detects a change in its position relative to the ground,
and you can use the iphoneDeviceOrientation() function to find out the current orientation.
This message is sent to the current card of the default stack.
The orientationChanged message is sent before any automatic interface rotation takes place thus changes to the orientation
lock state and allowed set can be made at this point and still have an effect.
If you wish to perform an action after the interface has been rotated, then either do so on receipt of resizeStack,
or by using a send in 0 millisecs message.
-------------------------------------------------------
Looks like you re-size your objects just too early?
Try to change "orientationchanged" with "resizestack", maybe that will be enough.
Best
Klaus