different buttons and/or graphics per record and fancy combo

Discuss all feature requests you have for a new Servoy versions here. Make sure to be clear about what you want, provide an example and indicate how important the feature is for you

different buttons and/or graphics per record and fancy combo

Postby pbakker » Wed Jan 28, 2004 10:38 am

Cryptic description, let me explain... :-)

I would like to have the option to show a bunch of records, for example in Listview or Portal. Per record, I would like to add a button of an image, but based on content of the record (for example the status field) enable/disable the button, maybe show a different label of the button, or, in the case of an image, show different images, based on the content of the record (for example show different color trafficlights)

Currently, I do not know a way to do this (please correct me if I'm wrong.... :D )

Also, the same sort of thing I would like to do with valuelists attached to a combo box. Let me give an example of where this comes in handy:
I'm in the proces of building a report generator. The reports can be flat data or a graph. secondly, some have specific time intervals in which the report can be run. Now, I display the available reports in a dropdown list of a combo box. What I would like to add in front of the report name is a clock image if the report can only run during a specific time interval and also add a graph image if the report is of type = Graph.

Nice feature requests, right? :)

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby IT2Be » Wed Jan 28, 2004 12:04 pm

Maarten and Johan brought it to my attention a few weeks ago that we can already add graphics or other properties like color etc. to data in any view. You can use a calculated field with html in it. You would then use something like (in htis case changing font, color and size):

Status = '<html><font face="Helvetica,Arial" color="#ff9933" size="2">' + Status + '</font></html>'.

Offcourse you can also use this to attach a picture...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby pbakker » Wed Jan 28, 2004 11:48 pm

Marcel, thanks for the reply.

I had to fiddle around with it a bit, but got it working in the end: for all that want to try it, here's some code. Place this code in the Calculation Area of a calculated field (of return type= media). Then place a field or label into, for example, your listview and attach the calculated field to it. If using a field, make sure it's of type = HTML.

if(status==1)
{
return '<html><img src="media:///j2db.gif"></html>'
}
else
{
return '<html><img src="media:///Logo.GIF"></html>'
}

Take care: the names of your images are case sensitive.....

As for having a picture in the drop down of the combo, I figured out the following.....
If you make a valuelist with custom values and then enter the following, in the dropdown you will see the picture!!!!

<html><img src="media:///flush.gif"></html>|1

The |1 part is what will be returned into the field onto which you attach the combobox, which displays the valuelist. Now the sad part is.... once you select the needed entry from the dropdown list, the picture disappears from the field and you see the HTML code again :(

Is there some way to fix this?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby pbakker » Wed Jan 28, 2004 11:49 pm

:D As you can se, the images are not available on the website....
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby jcompagner » Mon Feb 02, 2004 4:56 pm

if the combobox is not editable then it should be fine..

You can't use html and then set the combo on editable..
(because what do you edit then???)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8840
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby pbakker » Mon Feb 02, 2004 6:04 pm

Darn editable property.... kills me everytime!! sorry for waisting time.... :oops:
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby pbakker » Sun Feb 08, 2004 7:20 pm

Hi,

Just fiddling around with the HTML combo box and run into a bug, I think.

Made a custom value list and attached it to global field of display type = combo box. This is the content of the custom value list:

<html><img src="media:///flush.gif">Flush</html>|1
<html><img src="media:///status_icon.gif">Test</html>|2
<html><img src="media:///sound.gif">Test</html>|3
<html><img src="media:///open.gif">Mapje</html>|4
<html><img src="media:///new.gif">Test</html>|5
<html><img src="media:///save.gif">Disk</html>|6
<html><img src="media:///javaMailSession_00.gif">Email</html>|7
<html><img src="media:///962.gif">Wereldbol</html>|8

Now, you clcik on the combo box, the list appears with the pictures and the text. Now, if I scroll up and down with my mouse, all text disappears on scrolling down and comes ack when I scroll up again.

If I browse through the dropdown with my cursor keys, then, when previeously having selected an item allready, when passing over the allready selected item in the dropdownlist, the text disappears, when scrolling up again the text shows again, only now it white, but in black.

Looks like some kind of bug to me..

Working on windows XP, latest RC, java 1.4.2 and standard LAF

Paul

PS: Any tip on how to line out the text under eachother would b appreciated... :D
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby jcompagner » Sun Feb 08, 2004 8:07 pm

yes already seen this. i fixed it in RC5.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8840
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby pbakker » Mon Feb 09, 2004 10:20 am

tnx Johan.

Any tip on how to make sure that the text lines out under eachother if you have pictures in front of them?

I tried it with < table> in HTML, but didn't get the correct result yet (don't think you can set the width per column with this command, right?)

Other option would be to make sure all the images have the same size, I guess.

Any other (more correct) way of doing this?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby jcompagner » Mon Feb 09, 2004 10:32 am

can't you try it with a table/align (didn't test it)

<html>
<body>
<table>
<tr>
<td>image</td>
<td>text</td>
</tr>
</table>
</body>
</html>
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8840
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby pbakker » Mon Feb 09, 2004 8:06 pm

Hi, fiddled with it and here's the solution:

<html><table><tr><td width="25px" align="center"><img src="media:///flush.gif"></td><td width="60px">Flush</td></tr></table></html>|1
<html><table><tr><td width="25px" align="center"><img src="media:///status_icon.gif"></td><td width="60px">Test</td></tr></table></html>|2
<html><table><tr><td width="25px" align="center"><img src="media:///sound.gif"></td><td width="60px">Test</td></tr></table></html>|3

Just dop this code in a custom valuelist and attach it to a combo box type of field.

This gets you a drop down list with images, where the image is the first column and the text is the second column. The images are centered in their column and the Text is nicely left aligned, under eachother.

So, when the disappear bug is fixed in RC5, you can have yourself a nice fancy combobox :-)

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Displaying calculated image

Postby ahmad » Wed Aug 11, 2004 10:09 am

Hi

I have a field called general_tag.

If this tag ==1 then I want to show an image in the list .

If not then I want show a different image.

I created a calculation using the tip given in this post

Code: Select all
if( general_tag == "1")
{
return '<html><img src="media:///TagBlue.GIF"></html>'
}
else
{
return '<html><img src="media:///TagGrey.GIF"></html>;'
}


I placed the calculation media field on my list. Also checked the displays tags property but it only shows html text not the image

Am I missing something?

Thanks
Ahmad
ahmad
 
Posts: 139
Joined: Wed Dec 24, 2003 12:01 pm
Location: Hong Kong

Postby ahmad » Wed Aug 11, 2004 12:48 pm

This worked after I used a text label to display the calculated field instead of media field

Thanks
Ahmad
ahmad
 
Posts: 139
Joined: Wed Dec 24, 2003 12:01 pm
Location: Hong Kong


Return to Discuss Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest