Page 1 of 2

List field size organizing

Posted: Mon Oct 21, 2013 9:54 am
by appmann
Hi.

I have a field in my app. I want to make it almost fill out the window. And then when I pres button i want it to be the half of the screen and some fields and buttons apear.

Should I make two cards. one with full listview and one with half size and the buttons and fields.

Or should i make it on one card and just resize the listfield and make the buttons and fields apear on a MouseUp event?

One of the problems i have with livecode is to find the best and (for the user) fastest way to to actions. There are always at last 2 ways to do it.
Im only making mobile Apps, but i cant find anything that says: this would be the fastest way for a smartphone to handle this option.
Are there a guide or something tells something about this?
Are there a "Golden Rule" when i code for mobile?

Re: List field size organizing

Posted: Mon Oct 21, 2013 2:45 pm
by dunbarx
Hi.

It is a good thing that there are many ways to make your wishes come true. This is a reflection of LC's power and flexibility.

I would keep one card. It makes more sense for me that way, and resizing seems more natural that showing two cards with two fields.

Craig Newman

Re: List field size organizing

Posted: Mon Oct 21, 2013 8:28 pm
by appmann
Thx Dunbarx.

Is it possible to add a visual effect to the field, rolling up and down?

It could be nice, just like "native" apps in both Android and IOS.

And how can i resize the field without moving it? I tryed to set the size to the half of original "400 to 200".
But when i resize, the field just move itself to fit to the center position.

I have also tryed to lock position to right and bottom, but it still moves.

Am I missing something? Or of cause. I am missing something.

Re: List field size organizing

Posted: Mon Oct 21, 2013 10:57 pm
by dunbarx
Ah. Such fun.

Try something like this, but do go to the dictionary and look up the "lock screen" command.

Code: Select all

on mouseUp
   if the width of fld 1 = 272 then
       lock screen for visual effect 
       set the width of fld 1 to 172
        unlock screen for visual effect scroll up 
   else
          lock screen for visual effect 
       set the width of fld 1 to 272
        unlock screen for visual effect scroll down 
   end if
end mouseUp
Note that when you set the width of a control, you are maintaining the loc of that object. In your case, it sounds like you want to maintain the "topLeft" of the object. Can you manage this? Write back if you get stuck.

Craig

Re: List field size organizing

Posted: Tue Oct 22, 2013 9:10 am
by appmann
Hi Dunbarx.

It Worked very well (what code says) but.

Im trying to resize the hight and not wight. just corrected that.
And i want to maintain the "downRight (or Left)" of the field.
The visual effect scrolls up and down the whole card. I just want the visual effect to take effect on the object (field).

Re: List field size organizing

Posted: Tue Oct 22, 2013 10:03 am
by appmann
I have tryed with the line

set the height of fld "ProfilesList" to 170 with visual effect scroll down.

Is this possible? what do I do wrong?

Re: List field size organizing

Posted: Tue Oct 22, 2013 10:41 am
by Klaus
appmann wrote: set the height of fld "ProfilesList" to 170 with visual effect scroll down.
Is this possible?
No!
appmann wrote:what do I do wrong?
Using "visual effect..." with the wrong syntax!

The dictionary is really not that bad, please look up unknown or obviously not really known
terms like "visual effect" from time to time! 8)

Re: List field size organizing

Posted: Tue Oct 22, 2013 11:49 am
by appmann
Maby its just me.

But i cant figure out, how to use the visual effect this way on objects.

I can make it work on changing cards. but not this resizeing.

And i have tryed to look in dictionary. Looked up the "visual Effect" and looked the options to set. But cant make it work.

Re: List field size organizing

Posted: Tue Oct 22, 2013 11:56 am
by Klaus
It does not work with resizing directly!

The working principle is like this:
1. lock screen for visual effect
2. Make your changes to objects -> set height/width of objec(s)
3. Unlock screen with visual effect

Re: List field size organizing

Posted: Tue Oct 22, 2013 12:16 pm
by appmann
Hi Klaus.

I think you are right like always.
But im wondering why i can find this in the livecode lessons then.

hide field 1 with visual effect dissolve.

Why are they using the "with" command in this case?

Re: List field size organizing

Posted: Tue Oct 22, 2013 12:19 pm
by appmann
i also tryed with this.

lock screen for visual effect
set the height of fld "ProfilesList" to 170
unlock screen for visual effect scroll down

But it make the visual effect on the whole card. My wish is, only to make the effect on the list field.

And still keeping the position of the field.

Re: List field size organizing

Posted: Tue Oct 22, 2013 12:20 pm
by Klaus
appmann wrote:hide field 1 with visual effect dissolve.
Why are they using the "with" command in this case?
No idea, but yes, the syntax is a bit messed up and does not look like it follows a "strict rule".

Re: List field size organizing

Posted: Tue Oct 22, 2013 1:27 pm
by appmann
but when i use the lock and unlock screen, the "effect" takes place for the card and not only the object.

Is it possible at all with LC to make visual effects just to an object when resizing it and not hide and show?

Re: List field size organizing

Posted: Tue Oct 22, 2013 3:37 pm
by Klaus
Hi appman,

AHA! :D
Yes, check "lock screen" in the dictionary!
You can add a parameter for the RECT you want to update, maybe this will work for you:
...
lock screen for visual effect in rect (the rect of fld "ProfilesList")
## You may need to play a bit with the correct rect
## maybe calculate the new rect (with new height 170) first and use that one...
set the height of fld "ProfilesList" to 170
unlock screen for visual effect scroll down
...

Best

Klaus

Re: List field size organizing

Posted: Tue Oct 22, 2013 7:20 pm
by appmann
Thx.

Ill try to find something about the "rect".

Lets see if its working.