1

I am creating a SD App in GX Ev3, and am working on a list. I came across a requirement for the App and don't know how to do it.

I have to concatenate some Attributes in a String, but one of them (&Status) has to be Font Bold.

&Status + ', por ' + &User + ' em ' + &Date

Possible results:

  • 'OK, por User1 em 01/07/2014'
  • 'Com problema #5, por User2 em 01/07/2014'
  • 'Por validar, por User3 em 01/07/2014'

How can I do it, so it looks like continuous text?

matiash
  • 54,791
  • 16
  • 125
  • 154
Jaime
  • 159
  • 2
  • 10

3 Answers3

1

You can do that by using a variable based on the Html domain, and using HTML formatting for the value (i.e. "<b>OK</b>, por ...").

This will create a WebView to display the text, achieving the effect you want.

However, WebViews are unfortunately more resource-intensive than edits, so using them inside a grid is not recommended. We hope to provide a better solution soon.

matiash
  • 54,791
  • 16
  • 125
  • 154
  • Works! Will have to do for now, until there's a better solution. Thank you. – Jaime Jul 02 '14 at 09:09
  • Well, as you said, there is a negative impact as the navigation gets increasingly slow when rows are added to the grid. I'll try to negotiate a different approach with the client involving the use of two edits. Thanks. – Jaime Jul 02 '14 at 10:16
1

I would do the HTML field as matiash suggested

But if you want other solution you could do a User Control that can help you. In an application we have been developing for iOS we have done this using the NSAttributeString. https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/classes/NSAttributedString_Class/Reference/Reference.html

What we did is:

&varUC = "@"+&Status +"@ my middle text 1 @" + &User + "@ my middle text2 @"+&Date+"@"

In our UC we separated the string by the "@" and we changed the the color and weight of those words, then remove the @ when displaying the text.

For Android, we haven't done this yet, but with a quick Google search I think you should use: how to change text color in the middle of the sentence in android

Doing a User Control for GeneXus Smart Devices is really easy -> http://wiki.genexus.com/commwiki/servlet/hwikibypageid?15301

Community
  • 1
  • 1
Franklin
  • 881
  • 1
  • 8
  • 28
  • Yes, for the Android implementation of this UC you could use either `Spannables` or `Html.fromHtml()`. That allows including markup (i.e. typeface, font variations, colors, backgrounds, &c) into a `CharSequence`, that a `TextView` can then display. – matiash Jul 02 '14 at 16:59
  • UserControl? Well, that's great suggestion and a nice challenge :) Thanks – Jaime Jul 02 '14 at 17:25
0

You can try using the tag "after" in the definition of the class, but you'll have to split the atribute.

Your best bet is to split the variables on the screen, both with distinct classes:

&Status &Text

&Status = 'OK' &Text = ', por'+&User+' em '+&date

The css sample below is used to automatically set bold fields and (*) on the label of required fields:

.RequiredDataDescription:after 
{
    font-size: 11px;
    font-weight: bold;
    color: #333333;
    content:" (*)";
}