Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
14
Erster Beitrag:
vor 4 Jahren, 5 Monaten
Letzter Beitrag:
vor 4 Jahren, 5 Monaten
Beteiligte Autoren:
Michael Drechsel, Eric Wiegert, Jose Antonio Garrido, Arie, GuenterP, Piet van Zanten

[WD17] Report with traffic lights (red, yellow, green)

Startbeitrag von Michael Drechsel am 11.11.2013 13:05

Hi,

I need a "traffic light" indication in my report. My first idea was to modify the brushcolor but my client wants a circle.

So I put a image in my project and use the preprint code section to modify the ..image property. So far so good.

But the row heights are variable and the image is stretched. That doesn´t look good.

So my second idea was to use a special character(149). This works but the circle a very small.

Any other ideas ?

Antworten:

Hi Michael, are .ico files distorted too?

von GuenterP - am 11.11.2013 18:03
Maybe you can set the image size back to its original size during in a post-print section?

von Arie - am 11.11.2013 18:30
Now I'm thinking about it. Post-print could mean; alredy printed, so I;m not sure if it will work this way.
But maybe there is some point after your image is stretched and before it is actually printed.

von Arie - am 11.11.2013 18:32
Yes, I looks like any type of images ...

von Michael Drechsel - am 11.11.2013 18:49
Hi.

Right click on your control image.
In the description window select display mode "100%" instead of "homothetic center".

Regards,
José Antonio.

von Jose Antonio Garrido - am 11.11.2013 22:26
Hi Jose,

there is no "control". I use

myself..image="windows\red.png"

in the preprint code section of a item in a report.

von Michael Drechsel - am 12.11.2013 14:49
Hi Michael,

Then you'd better use an image control instead of a background image, it gives you much more control over the appearance of the image.

Regards,
Piet

von Piet van Zanten - am 12.11.2013 15:33
Hi Piet,

I tried this, but it looks bad. The even/odd colors are behind the image. The circle.png is not really a circle because WD ignores the transparent part and so on ...

Thx for the reply but for now I can live with my character(145) solution.

von Michael Drechsel - am 12.11.2013 16:07
Michael

You can try something like the following although I have not tested in a report.

Create some variables in your report.
sR is string = gCircle(0,4,8,12,PastelRed,Black)
sY is string = gCircle(0,4,8,12,PastelYellow,Black)
sG is string = gCircle(0,4,8,12,PastelGreen,Black)

When you need the colored circle just set an existing text item..value = sR or just issue a print statement.

You can alter the x1,y1,x2,y2 to increase the size (i choose 8 pixels)

If you are utilizing this in a control that contains no other text then you can also create your variables with an alignment spec:
gsRC is string = gAlignment("CV",gCircle(0,4,8,12,PastelRed,Black))
gsYC is string = gAlignment("CV",gCircle(0,4,8,12,PastelYellow,Black))
gsGC is string = gAlignment("CV",gCircle(0,4,8,12,PastelGreen,Black))

This would allow you to play with the size of the bounding control but specify the text to center

You can change the gAlignment from Center to Left or Right. Or omit the gAlignment and it will default to Left justified.

If this does not work for you I'm still not convinced that you can't make an image control work for you, but I would need the report to investigate further

von Eric Wiegert - am 12.11.2013 18:22
Hi Eric,

nice idea, but it seems that this works only in combos and listboxes.

thx

von Michael Drechsel - am 12.11.2013 18:51
Michael

While I have not tried it specifically in a report I have been utilizing this technique for years as a method to indicate a records status in tables etc. so it certainly is not limited to lists and combos.

von Eric Wiegert - am 12.11.2013 19:04
Hi Michael.

For me all the graphics i have used did always look exactly like it should.
I use PNG32.

I think that other formats like PNG8 can use different types of transparency (i think that are called index, and alfa transparecy), and don't know if that can be the problem. Anyway I use PNG32 and the images look exactly like it should, pixel by pixel, and transparency too.

I use Adobe Fireworks.

Regards,
José Antonio.

von Jose Antonio Garrido - am 12.11.2013 20:45

Re: [WD17] Report with traffic lights (red, yellow, green) [SOLVED]

Finaly I use the font "webdings" with the character(110). The circle is big enough and the even/odd colors for the background are also usable.

von Michael Drechsel - am 13.11.2013 12:51
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.