Example of a scrolling list field text centered vertically

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Example of a scrolling list field text centered vertically

Post by bn » Tue Feb 08, 2011 2:16 pm

Hi all,

I post a stack that shows a scrolling list field for iOS that centers the text vertically.
scrolling list field.png
scrolling list field.png (36.44 KiB) Viewed 8341 times
I set the HTMLtext of the field with superscript of the text. Then I apply a textShift to adjust the amount of pixels for superscript to center the text vertically.

The logic is in the "fill field" button.

Kind regards

Bernd
Attachments
lcMobileScroll_0.0.4.livecode.zip
(10.75 KiB) Downloaded 533 times

RickD
Posts: 31
Joined: Thu Feb 11, 2010 5:47 pm

Re: Example of a scrolling list field text centered vertically

Post by RickD » Tue Feb 08, 2011 5:30 pm

Hi Bernd:

The dev team is implementing so many new features and at such a fast pace that they don't have the time to provide sample code for every new addition they incorporate into the language. Code samples like the one you have provided saves the developer community a ton of time spent in trial and error trying to figure out what works and what doesn't.

Thank you so much for posting this sample stack and for actively helping out in this forum!

Cheers

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Example of a scrolling list field text centered vertically

Post by JosepM » Thu Mar 31, 2011 12:43 pm

Hi,

Thanks for this example work really fast and smoothy.

I thinking about how to show two lines into each row, maybe with HTML format and setting a <BR> and other text size for the second row?


Salut,
Josep

RickD
Posts: 31
Joined: Thu Feb 11, 2010 5:47 pm

Re: Example of a scrolling list field text centered vertically

Post by RickD » Thu Mar 31, 2011 3:34 pm

Hi Josep:

Your idea might work but a separate solution would be to go with a datagrid. You have full control on what you want to display in a datagrid.

Cheers

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Example of a scrolling list field text centered vertically

Post by JosepM » Fri Apr 01, 2011 12:05 am

Yes, but the scroller movement are very buggy and the performance is low.

Thougths?


Salut,
JosepM

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: Example of a scrolling list field text centered vertically

Post by adventuresofgreg » Tue May 24, 2011 5:32 pm

Hello Bernd: Thanks for posting this. However, I was looking for a solution that performs like a standard iOS scrolling field (smooth scroll with fast refresh). Your code works, but the scroll is not smooth and seems intermittent. There is another solution that I found in the forum called "My Scroller", and it seems slightly smoother, but still not the same as a standard scrolling field. (I am running on an iPhone 4).

digifilm
Posts: 12
Joined: Sat Mar 12, 2011 5:44 pm
Location: NYC
Contact:

Re: Example of a scrolling list field text centered vertically

Post by digifilm » Thu Jun 09, 2011 5:53 pm

Hi Bernd,

Is it possible to turn off the on mouseUp bg hilite on certain lines of list.

Thanks,
Debdoot

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Example of a scrolling list field text centered vertically

Post by bn » Thu Jun 09, 2011 5:58 pm

Hi DebDoot,
Is it possible to turn off the on mouseUp bg hilite on certain lines of list.
could you please explain what the conditions to turn hilite of lines on and off?. It is actually a list field and if you can specify a little I see if I can do something.

Kind regards

Bernd

digifilm
Posts: 12
Joined: Sat Mar 12, 2011 5:44 pm
Location: NYC
Contact:

Re: Example of a scrolling list field text centered vertically

Post by digifilm » Sat Jun 11, 2011 5:46 pm

Hi Bernd,
could you please explain what the conditions to turn hilite of lines on and off?. It is actually a list field and if you can specify a little I see if I can do something.
What I was trying to do is something like the following:

line varClickLine of fld "fldRolf" = 1 then
disable line 1 of fld "fldRolf"
exit mouseup

I did not want the hilite to work in certain lines of the list if you clicked on them.

Regards,
Debdoot

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Example of a scrolling list field text centered vertically

Post by bn » Wed Jun 15, 2011 3:13 pm

Hi debdoot,

in the script of the field "fldRolf" there is a part of the code that decides whether it is a click or not. Then it sets the hilite of that line:

Code: Select all

 if (abs(the mouseV - sY) < 10) and (abs(the mouseH - sX) < 10) and (tTestForEmpty <> "") then 
      put true into tIsAClick
      put word 2 of the mouseLine into tClick
      set the hilitedLine of me to tClick
   end if
If you put your conditional around "set the hilitedLine of me to tClick" you can suppress the hiliting of the line. If you also don't want an action like going to the next card you could include the "put true into tIsAClick" into your conditional.

Kind regards

Bernd

Post Reply

Return to “iOS Deployment”