Page 1 of 1

Questions about Dialog

Posted: Fri Jun 28, 2024 11:16 am
by Dirk Geppert
Hi guys,

1. how to add a placeholder text to stringgadgets within dialogs?
2. how to change the editorgadget style - i need a padding

Code: Select all

! $("<style>.dijitTextArea { padding: 4px; font-family: Arial; font-size: 12px; line-height: 12px; font-style: normal; font-weight: normal; }</style>").appendTo("head");  
does not work, only on standard editorgadget()
3. how to add labes? in this case they are to far from the input gadgets

Code: Select all

Runtime Enumeration Windows
	#eWnd
EndEnumeration

Runtime Enumeration Gadget
	#T_KATEGORY
	#S_KATEGORY
	#T_CAREOF
	#S_CAREOF
	#T_NAME
	#S_NAME
	#T_ZIP
	#S_ZIP
	#T_CITY
	#S_CITY
	#T_STREET
	#S_STREET
EndEnumeration


Procedure.s GetXMLString()
	Protected XML$

	XML$ + "<?xml version='1.0' encoding='UTF-16'?>"
	XML$ + "<dialogs>"
	XML$ + "  <window text='Backend' minwidth='1220' minheight='830' flags='#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered' name='#eWnd' xpos='0' ypos='0' id='#eWnd'>"
	XML$ + "    <hbox>"
	XML$ + "      <vbox>"
	XML$ + "        <hbox>"
	XML$ + "          <vbox>"
	XML$ + "            <text text='Kategorie' id='#T_KATEGORY'/>"
	XML$ + "            <string width='190' height='40' id='#S_KATEGORY'/>"
	XML$ + "          </vbox>"
	XML$ + "          <vbox>"
	XML$ + "            <text text='Care of' id='#T_CAREOF'/>"
	XML$ + "            <string width='220' height='40' id='#S_CAREOF'/>"
	XML$ + "          </vbox>"
	XML$ + "          <vbox>"
	XML$ + "            <text text='Name' id='#T_NAME'/>"
	XML$ + "            <editor width='380' height='40' id='#S_NAME'/>"
	XML$ + "          </vbox> "
	XML$ + "        </hbox>"
	XML$ + "        <hbox>"
	XML$ + "          <vbox>"
	XML$ + "            <text text='ZIP' id='#T_ZIP'/>"
	XML$ + "            <string width='100' height='40' id='#S_ZIP'/>"
	XML$ + "          </vbox>"
	XML$ + "          <vbox>"
	XML$ + "            <text text='City' id='#T_CITY'/>"
	XML$ + "            <string width='300' height='40' id='#S_CITY'/>"
	XML$ + "          </vbox>"
	XML$ + "          <vbox>"
	XML$ + "            <text text='Street' id='#T_STREET'/>"
	XML$ + "            <string width='380' height='40' id='#S_STREET'/>"
	XML$ + "          </vbox> "
	XML$ + "        </hbox>"
	XML$ + "      </vbox> "
	XML$ + "    </hbox> "
	XML$ + "  </window>"
	XML$ + "</dialogs>"

	ProcedureReturn XML$
EndProcedure

CompilerIf #PB_Compiler_IsMainFile

	a$ = GetXMLString()
	If ParseXML(0, a$) And XMLStatus(0) = #PB_XML_Success
  
	  CreateDialog(1)
	  OpenXMLDialog(1, 0, "#eWnd")
	  
	Else
		Debug XMLStatus(0)
		Debug XMLError(0)
	EndIf
	
	SetGadgetText(#S_NAME, "looks like some padding is needed")
	SetGadgetText(#S_KATEGORY, "Placeholder?")
CompilerEndIf

Any help is appreciated.

Re: Questions about Dialog

Posted: Fri Jun 28, 2024 11:37 am
by Dirk Geppert
I have now found tips (presumably from Peter) that solve the first two problems.

Code: Select all

Procedure SetGadgetStyle (hGID, style.s)
    ! dijit.byId(v_hgid.gadget.id).set("style", v_style);
EndProcedure

SetGadgetStyle(GadgetID(#EDITOR), "padding: 4px;")

Code: Select all

Procedure SetGadgetPlaceHolder(gadget, text.s)
  ! var GadgetElement = $(spider_GadgetID(v_gadget).div);
 
  Select GadgetType(gadget)
    Case #PB_GadgetType_String, #PB_GadgetType_Spin, #PB_GadgetType_Date, #PB_GadgetType_ComboBox
      ! GadgetElement.find("input").attr("placeholder", v_text);
    Case #PB_GadgetType_Editor
      ! GadgetElement.find("textarea").attr("placeholder", v_text);
      
  EndSelect
 
EndProcedure
SetGadgetPlaceHolder (#S_KATEGORY, "Kategorie")

Re: Questions about Dialog

Posted: Mon Jul 01, 2024 9:43 am
by Dirk Geppert
Does anyone have any idea how I can arrange the text gadgets downwards, directly above the associated gadget?