Code bold selected text

How can I set the selected text of a RTF field bold or unbold without the use of the Servoy toolbar?

In other words, I want the same functionallity as the bold button of the Servoy toolbar programmed out under my own button.

Does anyone have an idea or an example?

Its not possible to just call the same thing that the action does

You could look what really is changed for a rtf field and just recreate that behavior is scripting.

Is it possible to make a plugin that simulates that behavior?

it could but i dont think that is really easy to do because some are a bit internal
But if you know Swing and the JEditorPane/StyleEditorKit then i think something like this:

plugins.text.setBold(elements.rtffield)

could work

something maybe related,
what we do, is placing the text toolbar right at the top of the RTF or HTML-AREA, instead at the top only…

you can do this with the menubar plugin in 4. or the it2be menubar plugin in Servoy 3.5.

Harjo:
what we do, is placing the text toolbar right at the top of the RTF or HTML-AREA, instead at the top only…

Interesting… Harjo are you willing to share a codesnippet for this?

ofcourse! as always ;-)

place a bean: jToolbar on the place you want the toolbar and name it: text_toolbar
than in the onShow of that form I do:

plugins.menubar.addServoyToolBar(elements.text_toolbar, 'text')

that’s it!

Hi Harjo,

Since you also use text markup :

I notice a problem in the userinterface, it is not displaying the actual status of (for instance) the bold setting.

See first picture below :

i inserted 4 lines of text and then selected part of the second line and set it to underlined.
[attachment=1]p123.png[/attachment]

then i put the cursor at the end of the last line and start typing. The Underline icon is still highlighted.
However, when is start typing the text is not underlined.
When i then deselect the underline setting and start typing the typed text gets underlined.
See second picture.[attachment=0]p45.png[/attachment]
This is very confusing for the user.
Also when the user puts the cursor in an underlined section of the text, the underline icon in the toolbar is not activated.

Regards,

yeah I know, it’s not the best text editor.
but it will do for the stuff we use.

Harjo:
ofcourse! as always ;-)

thnkx! Looks nice and… easy to do!

Harjo:
ofcourse! as always ;-)

place a bean: jToolbar on the place you want the toolbar and name it: text_toolbar
than in the onShow of that form I do:

plugins.menubar.addServoyToolBar(elements.text_toolbar, 'text')

that’s it!

Hi Harjo, menubar plugin is not available in Servoy6, how can you do this now?

I would like to show a modal form with a RTF_Area with the text toolbar inside that form.

Thanks

jasantana:
Hi Harjo, menubar plugin is not available in Servoy6, how can you do this now?

Hmm…it’s there alright.

isn’t it called window?

Heh, I see the function toolbar and think immediately about plugins.window.. Totally not seeing that you wrote plugins.menubar. . :oops:
The menubar plugin was integrated into the window plugins a few versions back.

Hope this helps.

Robert I got it.

var win = application.createWindow(application.getUUID().toString(), JSWindow.MODAL_DIALOG);
win.title='Edición Modelo Contrato';
win.showTextToolbar(true);     // THIS DOES THE TRICK
forms.frmEdicionContratoLOPD_GSDespachos.controller.show(win);