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 cant imagine that it simply isnt possible in servoy.
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 ‘’+
‘
’+//width equals the width of the dataprovider country
‘’+
‘
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 dont know if Im 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 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?
I dont know if Im 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…
We need to do some filtering on these methods, cause al lot of them aren’t ment for usage inside the method editor
store your image in the media library
go in to designer, select Elements>Place Images and import your image
use this in your html:
myText
This code will do just fine for me.
Just one little problem I cant seem to reduce the image to fit the field or the button I planned to use. Ive 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 dont know if Im 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…
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 youd say that. (I notice Ive even typed overwhelmed wrong, you can figure my confusion)
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 )
I`ve just looked into another question and do you mean this??
//set the image in the button by url
elements.thumbnailButton.setImageURL(‘path/companyLogo.jpg’);
//Get the image data in jpg format from icon
var jpgData = elements.thumbnailButton.getThumbnailJPGImage();
application.writeFile(“mypicture.jpg”, jpgData);
Just one little problem I cant seem to reduce the image to fit the field or the button I planned to use. Ive 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.
create a table called IMAGES, columns: imageHolder, label
(store the images you need inside this table and label them)
create a relation from your listview(assume it’s companies) to the images table
companies_to_images >> companies.label=images.label
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
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)