Showing globalmedia through a calculation in list(Filemaker)

Release notes for Servoy betas

Showing globalmedia through a calculation in list(Filemaker)

Postby Rene » Sun Dec 28, 2003 2:59 pm

Hello everybody,

I`m looking for a way to comunicate with the users using colors and showing/hiding buttons and stuff like that in list view without changing the properties of an element because this will affect all the records in the form and not just one record. These functions should stay local because they only affect the current user.

I use these functions a lot in FMP because of its power not to overwelm the user with buttons and to showing crucial information for this user

Does anyone have a solution to this. because I can`t imagine that it simply isn`t possible in servoy.

Many thanks in advance, Rene
Rene
 
Posts: 121
Joined: Sat Dec 27, 2003 1:33 pm
Location: Venhorst, The Netherlands

Postby maarten » Sun Dec 28, 2003 5:04 pm

Here's one way of doing things.
(also check the solution attached)

This example changes the background of a country field to red when it equals "Germany" and green when it equals "Mexico".

How to do this:
1)in the list view, place an unstored calculation behind a dataprovider country. dataprovider is transparant, calc is non editable
2)calc goes like this:
if(country=="Germany")
{
return '<html>'+
'<table bgcolor="red" width=120>'+//width equals the width of the dataprovider country
'<tr><td>M- </td></tr>'+
'</table>'
}
else if(country=="Mexico")
{
return '<html>'+
'<table bgcolor="green" width=120>'+
'<tr><td>M- </td></tr>'+
'</table>'
}
Attachments
highLighting.servoy
(4.37 KiB) Downloaded 463 times
highlightRecord.jpg
highlightRecord.jpg (10.98 KiB) Viewed 6659 times
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Yes, Thats what I was looking for

Postby Rene » Sun Dec 28, 2003 5:48 pm

Yes, Thats what I was looking for.

Thank you very much Maarten.

But can I place a picture in the HTML string using it as background. for example a customized button.

I also could make a Global Media variable but how do I get the picture in at startup?
one way is to make a table containing the pictures as BLOB but is there another way??

I don`t know if I`m at the right track here and the functions available on a media (simple rectangel) Wow.... they are huge but what do they all mean
I was overwelmt :oops:

Rene
Rene
 
Posts: 121
Joined: Sat Dec 27, 2003 1:33 pm
Location: Venhorst, The Netherlands

Postby maarten » Sun Dec 28, 2003 7:10 pm

But can I place a picture in the HTML string using it as background. for example a customized button.


there are two ways:
1) store your image in the media library
go in to designer, select Elements>Place Images and import your image
use this in your html:
<tr><td background="media:///myImage.gif">myText</td></tr>

2) store your image inside the next folder
Servoy/server/webapps/ROOT/images
use this in your html:
<tr><td background="http://localhost:8080/images/myImage.gif">myText(or  )</td></tr>

NOTE: you can replace the hard coded part http://localhost:8080
with dynamic content, using this code:

var serverURL = application.getServerURL()
var myImage = serverURL+"/images/myImage.gif"
'<tr><td background= '+myImage+' >myText</td></tr>'
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby maarten » Sun Dec 28, 2003 7:15 pm

I also could make a Global Media variable but how do I get the picture in at startup?
one way is to make a table containing the pictures as BLOB but is there another way??

I'm not sure what you have in mind, but would it work by just importing all your images inside the image library or the ROOT folder of the server, and then use if statements to determine which image you want to show the user?
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby maarten » Sun Dec 28, 2003 7:18 pm

I don`t know if I`m at the right track here and the functions available on a media (simple rectangel) Wow.... they are huge but what do they all mean
I was overwelmt

I can imagine you were overwhelmed... :shock:
We need to do some filtering on these methods, cause al lot of them aren't ment for usage inside the method editor :?
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby Rene » Mon Dec 29, 2003 12:59 am

Yes now we are getting there.

:lol: :o :lol: :o :lol: :o :lol: :o :lol: :o :lol: :o

maarten wrote:
1) store your image in the media library
go in to designer, select Elements>Place Images and import your image
use this in your html:
<tr><td background="media:///myImage.gif">myText</td></tr>


This code will do just fine for me.

Just one little problem I can`t seem to reduce the image to fit the field or the button I planned to use. I`ve played a bit with the code but with no succes do you know a way o reduce / enlarge the background to fit on whatever size the output imageholder is??

Thank you very much Rene
Rene
 
Posts: 121
Joined: Sat Dec 27, 2003 1:33 pm
Location: Venhorst, The Netherlands

Postby Rene » Mon Dec 29, 2003 1:04 am

maarten wrote:
I don`t know if I`m at the right track here and the functions available on a media (simple rectangel) Wow.... they are huge but what do they all mean
I was overwelmt

I can imagine you were overwhelmed... :shock:
We need to do some filtering on these methods, cause al lot of them aren't ment for usage inside the method editor :?


I was kind of hoping you`d say that. (I notice I`ve even typed overwhelmed wrong, you can figure my confusion)

Rene
Rene
 
Posts: 121
Joined: Sat Dec 27, 2003 1:33 pm
Location: Venhorst, The Netherlands

Postby Rene » Mon Dec 29, 2003 1:15 am

maarten wrote:
I also could make a Global Media variable but how do I get the picture in at startup?
one way is to make a table containing the pictures as BLOB but is there another way??

I'm not sure what you have in mind, but would it work by just importing all your images inside the image library or the ROOT folder of the server, and then use if statements to determine which image you want to show the user?


How do I get the image available in the method editor or in a calculation??
Through HTML it works but if there is a more direct way (I have no HTML experiance as you`d allready figured out :oops: )

I`ve just looked into another question and do you mean this??

1)
//set the image in the button by url
elements.thumbnailButton.setImageURL('path/companyLogo.jpg');

2)
//Get the image data in jpg format from icon
var jpgData = elements.thumbnailButton.getThumbnailJPGImage();
application.writeFile("mypicture.jpg", jpgData);


Rene
Rene
 
Posts: 121
Joined: Sat Dec 27, 2003 1:33 pm
Location: Venhorst, The Netherlands

Postby maarten » Mon Dec 29, 2003 1:54 am

Just one little problem I can`t seem to reduce the image to fit the field or the button I planned to use. I`ve played a bit with the code but with no succes do you know a way o reduce / enlarge the background to fit on whatever size the output imageholder is??

I believe you cannot influence the size of the image when you use <td background= "image"

How do I get the image available in the method editor or in a calculation??

When you're in record view , you can simply attach an image to an element >> elements.button.setImageURL(="media:///myImage.gif")
But if you're in list view the whole column would be affected, which you don't want.
So here's another workaround for listviews.
1) create a table called IMAGES, columns: imageHolder, label
(store the images you need inside this table and label them)
2) create a relation from your listview(assume it's companies) to the images table
companies_to_images >> companies.label=images.label
3) create a button in your listview and set it's dataprovider(property)
with companies_to_images.imageHolder
the image will now be determined by the labelcolumn (left hand key) in companies
4) you can now also use the button's mediaOptions-property in order to control the image size in the button.

NOTE: I haven't tested this on a large list yet.
(might be slower then using the HTML method)
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands


Return to Latest Releases

Who is online

Users browsing this forum: No registered users and 2 guests

cron