on 12-15-2006 11:19 AM
Hi there,
can somebody tell me how you can change the default font for the BTF editor? Default is TimesRoman and I want to use Arial...
already checked out editor_default.js and the CL_BTF_BSP_EDITOR, but cant find where to hack in
Thanks
Gerald
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
after the btf editor declaration in the layout add the highlighted java script
<btf:editor id = "btf1"
document = "<%= btf_document_ds %>"
disabled = "<%= disabled %>"
height = "100%"
width = "100%"
onClientInsertImage = "InsertImage_BTFEditor(id);"
onClientInsertLink = "InsertLink_BTFEditor(id);"
sourceView = "FALSE" />
<b><script>
document.myform.BTFEditor_FontName_btf1.options[0].selected = true ;
</script></b>
in the above javascript
myform = form id
BTFEditor_FontName_btf1 =btf1 is the id of your btf editor
options[0] = Arial
options[1] = Courier New ,etc
Regards
Raja
Dear Raja,
thanks for ur suggestion. I've already tried that, but it doesnt seem to be the solution.
font and fontsize are not selected yet once the editor starts with an empty document. only when I place the cursor in the imput area "times roman" and "3(12pt)" are automatically selected by the extension. it seems that these values are set upon an event like "placed curso into input area" and read by the class from some variables or js-file...
any idea?
Thanks
Gerald
ps.
when I start the application in firefox I can see that your code kind of works as now arial is selected. but the extension has its problem in fox as the the dropdowns are grayed out and the text is not shown properly...
one way to achieve is set some info text in the empty document with the rquired font.
something like below
move '<font face="Arial">Enter the definition here... <br>You can add pictures, web addresses and use HTML markup!</font>' to temp_text.
assign temp_text to <string> casting type x.
****Convert the Text Input and Cast it to a Binary String
move <string> to desc.
**** encoding is a string constant with value 'utf-8'
btf_document_ds->set_content(
text = desc
encoding = encoding ).
Regards
Raja
also tried that, looks nice in the editor, but the generated HTML in the background gets messed up by this.
guess found where the defaults can be set. check out interface IF_BTF_CONFIGURATION, method SET_DEFAULT_FONT.
as old school abaper, i'm not yet pro in OO.. any idea how to implement that IF in my OnCreate handler?
here my handler OnCreate:
IF g_s_documentdata-btf_doc IS INITIAL.
DATA: l_v_errtxt TYPE string.
DATA: l_r_btf TYPE REF TO if_btf.
DATA: l_r_document TYPE REF TO if_btf_document.
* create reference to editor
l_r_btf = cl_btf=>get_reference( ).
DATA: l_r_exc_r TYPE REF TO cx_btf_runtime_error,
l_r_exc_p TYPE REF TO cx_btf_parameter_error.
TRY.
l_r_document = l_r_btf->create_document( sy-langu ).
CATCH cx_btf_runtime_error INTO l_r_exc_r.
l_v_errtxt = l_r_exc_r->get_text( ).
ENDTRY.
* connect document with editor
g_s_documentdata-btf_doc = l_r_document.
ENDIF.
thanks
Gerald
data: btf_config TYPE REF TO IF_BTF_CONFIGURATION .
DATA: font TYPE tdfamily .
CALL METHOD l_r_btf->create_configuration
EXPORTING
language = sy-langu
RECEIVING
configuration = btf_config.
IF NOT btf_config IS INITIAL .
CLEAR font .
MOVE: 'HELVE' TO font .
CALL METHOD btf_config->set_default_font
EXPORTING
font = font.
ENDIF .
IF l_r_document IS INITIAL.
*TRY.
CALL METHOD l_r_btf->create_document
EXPORTING
language = sy-langu
configuration = btf_config
RECEIVING
rval = l_r_document .
* CATCH CX_BTF_RUNTIME_ERROR .
*ENDTRY.
the interal value for fonts are as follows
Arial |HELVE
Courier New |COURIER
OCRA |OCRA
OCRB |OCRB
Times New Roman |TIMES
This is the way to do it. however, this doesnt seems to solve the problem. it still defaults to Times new Roman.
Regards
Raja
Thanks Raja for explaining hmm, yeah unfortunately the problem still persists...
client will have to live with it for the meantime...
will try to debug a bit more around when I find the time and hope x-mas will bring the solution or that sb from SAP will read this - looks to me like one of these bugs
thanks again and take care
Gerald
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.