Override style of Editorgadget?

Just starting out? Need help? Post your questions and find answers here.
StoneOakvalley
Posts: 35
Joined: Tue Apr 05, 2016 2:14 pm
Location: Norway
Contact:

Override style of Editorgadget?

Post 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?
Registered owner of PureBasic and SpiderBasic :-) Good stuff!
User avatar
Peter
Posts: 1197
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Override style of Editorgadget?

Post by Peter »

StoneOakvalley wrote:Now, I want to remove the border around it

Code: Select all

SetEditorGadgetStyle(YourEditorGadget, "border", "none")
Greetings ... Peter
StoneOakvalley
Posts: 35
Joined: Tue Apr 05, 2016 2:14 pm
Location: Norway
Contact:

Re: Override style of Editorgadget?

Post 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:-)
Registered owner of PureBasic and SpiderBasic :-) Good stuff!
Post Reply