Page 1 of 1

Override style of Editorgadget?

Posted: Mon Mar 13, 2017 3:04 pm
by StoneOakvalley
I wanted to have some control over the EditorGadget, and I managed to find a small code in the forums for at least setting the align style of it.

Procedure SetEditorGadgetStyle(id,style$,value$)
!spider_GadgetID(v_id).gadget.textbox.style[v_style$]=v_value$
EndProcedure

Example:
SetEditorGadgetStyle(mygadget,"text-align","center")
and it would center the text inside the editorgadget perfectly.

Now, I want to remove the border around it, Inspect in Firefox tells me its
id="dijit_form_SimpleTextarea_1" and class="dijitTextBox dijitTextArea"

but are unable to style (override) it.

In my code I created just 3 editorgadgets, so they are numbered
dijit_form_SimpleTextarea_1
dijit_form_SimpleTextarea_2
dijit_form_SimpleTextarea_3

as id...

This is something I really struggle with for other types of gadgets as well, not always I want to see a border.

This one for instance, removed border from webgadget:
!$(v_wb.div).removeClass("sbWebBorder");

But unable to apply such things to other types of gadgets...

Any help?

Re: Override style of Editorgadget?

Posted: Mon Mar 13, 2017 6:52 pm
by Peter
StoneOakvalley wrote:Now, I want to remove the border around it

Code: Select all

SetEditorGadgetStyle(YourEditorGadget, "border", "none")
Greetings ... Peter

Re: Override style of Editorgadget?

Posted: Tue Mar 14, 2017 8:32 am
by StoneOakvalley
Quite right you are!

I tried this, but could get it to work, the entire gadget disappeared, and I found out why.

In my original code:
SetEditorGadgetStyle(makecanvas,"text-align","center")
SetEditorGadgetStyle(makecanvas,"border","none")
ResizeGadget(makecanvas,SlideData()\x.i+final_margin.f,SlideData()\y.i+GadgetHeight(SlideData()\gad_id.i),#PB_Ignore,#PB_Ignore)

Where the height was never specified, simply #PB_Ignore, making the gadget auto adjust in height needed to display my text.

However, once I switched them around a bit:
SetEditorGadgetStyle(makecanvas,"text-align","center")
ResizeGadget(makecanvas,SlideData()\x.i+final_margin.f,SlideData()\y.i+GadgetHeight(SlideData()\gad_id.i),#PB_Ignore,#PB_Ignore)
SetEditorGadgetStyle(makecanvas,"border","none")

Making the border style beeing applied after the gadget was resized instead just after it was created, it works as intended with center aligned text + no border.

Thanks Peter for confirming that the command I tought would work actually does:-)