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?
Override style of Editorgadget?
-
- Posts: 35
- Joined: Tue Apr 05, 2016 2:14 pm
- Location: Norway
- Contact:
Override style of Editorgadget?
Registered owner of PureBasic and SpiderBasic
Good stuff!

Re: Override style of Editorgadget?
StoneOakvalley wrote:Now, I want to remove the border around it
Code: Select all
SetEditorGadgetStyle(YourEditorGadget, "border", "none")
-
- Posts: 35
- Joined: Tue Apr 05, 2016 2:14 pm
- Location: Norway
- Contact:
Re: Override style of Editorgadget?
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:-)
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!
