
BBjControl::removeAttribute
Description
In BBj 22.13 and higher, this method removes a control attribute.
Syntax
Return Value |
Method |
---|---|
void |
removeAttribute(string attribute) |
Parameters
Variable | Description |
---|---|
attribute | Specifies an attribute to be removed from the control. |
Return Value
None.
Remarks
This functionality is primarily intended for manipulating low-level BUI element attributes or DWC component properties. When running in GUI, the attributes don't affect the control itself, but may be used by the developer.
Example
Copy
BBjControl::removeAttribute Example
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,500,550,"addEditBox",$00090083$)
window!.setBackColor(sysgui!.makeColor(250,250,250))
window!.setCallback(window!.ON_CLOSE,"eoj")
status! = window!.addStatusBar(100)
data "text","color","date","datetime-local","email","month"
data "number","range","search","submit","tel","time","url","week"
i = 101, x = 125, y = 25, w = 225, h = 25
while 1
dread type$,err=*break
statictext! = window!.addStaticText(i+100,0,y+5,115,h,type$,$8000$)
statictext!.setOpaque(0)
editbox! = window!.addEditBox(i,x,y,w,h,"",$$,type$)
editbox!.setBackColor(BBjColor.YELLOW)
editbox!.setForeColor(BBjColor.BLUE)
if type$ = "text" then
editbox!.setText("The quick brown fox jumps over the lazy dog.")
endif
if type$="color" then
color$ = "#" + hta(chr(rnd(255))) + hta(chr(rnd(255))) + hta(chr(rnd(255)))
editbox!.setText(color$)
endif
if type$="date" then
mask$ = "%Yl-%Mz-%Dz"
editbox!.setText(date(0:mask$))
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
editbox!.setAttribute("min",date(jul(0,0,0)-365:mask$))
editbox!.setAttribute("max",date(jul(0,0,0)+365:mask$))
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
endif
if type$="datetime-local" then
mask$="%Yl-%Mz-%DzT%Hz:%mz"
editbox!.setAttribute("step","0.001")
editbox!.setAttribute("step","1")
rem editbox!.setText(date(0:mask$))
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
editbox!.setAttribute("min",date(jul(0,0,0)-365:mask$))
editbox!.setAttribute("max",date(jul(0,0,0)+365:mask$))
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
endif
if type$="month" then
mask$="%Yl-%Mz"
editbox!.setText(date(0:mask$))
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
editbox!.setAttribute("min",date(jul(0,0,0)-365:mask$))
editbox!.setAttribute("max",date(jul(0,0,0)+365:mask$))
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
endif
if type$="number" then
editbox!.setText(str(50))
editbox!.setAlignment(editbox!.ALIGN_RIGHT)
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
editbox!.setAttribute("min","-100")
editbox!.setAttribute("max","100")
rem editbox!.setAttribute("step","any")
editbox!.setAttribute("step","0.01")
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
endif
if type$="range" then
editbox!.setText(str(50))
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
editbox!.setAttribute("min","-100")
editbox!.setAttribute("max","100")
rem print "min=",editbox!.getAttribute("min"),",max=",editbox!.getAttribute("max")
endif
if type$="time" then
mask$="%Hz:%mz:%sz.000"
rem editbox!.setText(date(0:mask$))
rem editbox!.setAttribute("step","0.001")
editbox!.setAttribute("step","1")
endif
if type$="week" then
mask$="%Yl-W%Wz"
editbox!.setText(date(0:mask$))
endif
if type$="submit" then
editbox!.setText("submit")
editbox!.setAttribute("value","submit")
endif
editbox!.setName(type$)
rem type$ = editbox!.getEditType(); rem ' this incurs the cost of a round trip
System.err.println("getAttribute placeholder = "+editbox!.getAttribute("placeholder"))
editbox!.setAttribute("placeholder","placeholder text goes here")
System.out.println("setAttribute placeholder")
System.out.println("getAttribute placeholder = "+editbox!.getAttribute("placeholder"))
System.out.println("removeAttribute placeholder")
editbox!.removeAttribute("placeholder")
System.out.println("getAttribute placeholder = "+editbox!.getAttribute("placeholder"))
System.out.println("setAttribute placeholder")
editbox!.setAttribute("placeholder","placeholder text goes here")
System.out.println("getAttribute placeholder = "+editbox!.getAttribute("placeholder"))
editbox!.setToolTipText(type$)
editbox!.setCallback(editbox!.ON_EDIT_MODIFY,"modify")
button! = window!.addButton(i+200,x+w+15,y-5,115,h+10,"getText",$$)
button!.setCallback(button!.ON_BUTTON_PUSH,"getText")
button!.setToolTipText(type$)
i = i + 1
y = y + h + 10
wend
window!.setVisible(1)
process_events
eoj:
release
getText:
event! = sysgui!.getLastEvent()
control! = window!.getControl(event!.getControl().getID()-200)
i = msgbox(control!.getText(err=*next),0,control!.getName(err=*next))
return
modify:
event! = sysgui!.getLastEvent()
editbox! = event!.getControl()
event$ = editbox!.getName()+" = '"+event!.getText()+"'"
status!.setText(event$)
print event$
return
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.