colored list

SuperCard 4.5 & 4.6 projects (.zip archives only please).

colored list

Postby S. Leys » Thu Jan 21, 2010 6:55 am

colored list.sc45.zip
(18.73 KiB) Downloaded 315 times
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: colored list

Postby drpitcairn » Thu Jan 21, 2010 8:50 am

Very nice. I was ready to try using it but got stuck on the part about "resetscroll" function as I have never used it. Searched the SC LG, also MPI guide and found nothing about this function. Can you give me a hint?
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: colored list

Postby S. Leys » Thu Jan 21, 2010 8:52 am

rpitcairn wrote:Very nice. I was ready to try using it but got stuck on the part about "resetscroll" function as I have never used it. Searched the SC LG, also MPI guide and found nothing about this function. Can you give me a hint?

It is in the script of the color mask.

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: colored list

Postby drpitcairn » Thu Jan 21, 2010 8:22 pm

Found it. Thanks.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: colored list

Postby S. Leys » Fri Jan 22, 2010 2:39 am

This is just a sample project. If you want to use this feature in your project, you must see how it works and adapt it.
First, look at the user properties of the 3 objects. You'll see how they are linked together. If you copy them and paste them into your project, their IDs may change, thus you'll need to change the user properties to keep the link, especially if you want several lists.
The list field is hidden by the color mask and the scrollbar thus not easy to select with the pointer tool but you can look at its userprop by context-clicking it in the list of the overview module.
If you edit the field by option-clicking the color mask, the resetscroll function will be called automatically when you'll switch back to the browse tool. But if you want to change the content or the textsize of the field by script, you'll need to call it.
For instance :
Code: Select all
put long id of cd fld ... into MyListField
set textsize of MyListField to 15
get resetscroll() via the mymask of MyListField

This will synchronize the scrollbar with the number of lines in the field and the height of each line (i.e. getCellHeight(MyListField)).
Ditto if you want to change the rect of the field by script, see how it is done on resizegraphic in the script of the mask.
You can do :
Code: Select all
set rect of the mymask of MyListField to r
send resizegraphic to the mymask of MyListField


The best is to look at the scripts and see how they work.

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: colored list

Postby drpitcairn » Fri Jan 22, 2010 8:21 am

Thanks. Looks useful. I will think how I could use it.
I have wondered about use of the colors in fields because if I select a field and then choose MPI menu "color" item "fillfore" or "fillback" it does not have any effect on the color of the field, so I have just not tried to use them with fields.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: colored list

Postby S. Leys » Fri Jan 22, 2010 8:31 am

rpitcairn wrote:I have wondered about use of the colors in fields because if I select a field and then choose MPI menu "color" item "fillfore" or "fillback" it does not have any effect on the color of the field, so I have just not tried to use them with fields.

Yes, it's an error in my menu handling. The pen properties are applied when the showframe is false and the showpen true but the fill properties don't have any effect, AFAIK, even if one can set them.

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: colored list

Postby S. Leys » Fri Jan 22, 2010 8:50 am

Stephane Leys wrote: the fill properties don't have any effect

I was wrong, they DO have an effect, as long as you choose the right fillpat (and the showfill is true).

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: colored list

Postby sctell » Fri Jan 22, 2010 11:22 am

Hi,

I am sure this example will be useful to many people, thanks.

A couple of related questions please.

Is

Code: Select all
put the textHeight of cd fld id 286


the same as

Code: Select all
put line 2 of getCellHeight("cd fld id 286")


and is

Code: Select all
put the number of lines of cd fld id 286 into tNumLines
put textheightSum(cd fld id 286) /tNumLines


different again.

If yes why?
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: colored list

Postby sctell » Fri Jan 22, 2010 11:30 am

Hi,

Out of interest the results of these options when run against the example give:


getCellHeight = 17
textHeight = 16
textHeightSum = 16

Thats interesting because the textHeight sum function is supposed to return the total pixel height of the text in the field. Why therefore would the textHeightSum/numOfLines be different than the cell height?
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am


Return to Sample & Demo Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron