How to bold a string in text item during run time?

yongyih
yongyih used Ask the Experts™
on
I know how to bold all string in text item by changing the text item properties during design time.

my question is how to set certain characters or strings in the text item to bold during run time. (using coding).

thanks first for your help.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can do it by using Visual attributes. Use the SET_ITEM_PROPERTY built in to change the visual attribute of an item at runtime!

Cheers, Stefan

Author

Commented:
If using set item property, it will change all string in text item, right?

please give me sample coding, thanks.
yes it will - and if it is a multirow block then you can use SET_ITEM_INSTANCE_PROPERTY instead.

the example is simple:


create two visual attributes, one with fontweight set to bold (name it VA2) and the other just leave all on default (name it VA1);

then in a when_button_pressed trigger, or wherever you want use the following to set the font to bold:

set_item_property ('text_item4',VISUAL_ATTRIBUTE,'VA2');



and the following to set the font again to normal:

set_item_property ('text_item4',VISUAL_ATTRIBUTE,'VA1');




Cheers, Stefan
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
This is my code in button trigger.

set_item_property ('text_item3',VISUAL_ATTRIBUTE,'normal_text');
:text_item3 := 'def';

set_item_property ('text_item3',VISUAL_ATTRIBUTE,'bold_text');
:text_item3 := :text_item3 || 'abc';

after click a buttom, all text in text_item3 is bold.
what i want is 'def' is normal text, 'abc' is bold.

any idea how to do this?


ok, i see where you are going to ... well, this is simply not possible with Oracle Forms - the textitems don't support such a thing (also not in designer mode!). You would have to look for an ActiveX of a RichEdit component, or a PJC when on web. Booth ways not really worth the troubles just for getting a text bold!

Sorry!

Cheers, Stefan

Author

Commented:
its ok. thanks for your help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial