Interface TextControl::setPlaceholderColor

Description

In BBj 17.0 and higher, this method sets the color of the placeholder text to be shown when the text control is empty.

Syntax

Return Value

Method

void

setPlaceholderColor(BBjColor color!)

Parameters

Return Value

Method

color!

This is the color of the placeholder text to be shown when the text control is empty. Passing a value of null() resets the placeholder color to the initial default.

Return Value

None

Remarks

The default placeholder color is light gray.

Example

rem ' placeholder.txt
begin
sysgui = unt
open (sysgui)"X0"
rem print (sysgui)'scale'(2,2)
sysgui! = bbjapi().getSysGui()
rem ' BBjWindow
window! = sysgui!.addWindow(25,25,500,525,"Placeholder",$00090003$,$$)
window!.setCallback(window!.ON_CLOSE,"eoj")
rem ' Spinner List
list! = bbjapi().makeVector()
list$ = ""
restore countries
while 1
  dread item$,end=*break
  list!.add(item$)
  list$ = list$ + item$ + $0a$
wend
rem ' BBjInputE
control! = window!.addInputE(101,10,10,125,25,$0000$,255," ",0,"","")
control!.setPlaceholder("BBjInputE")
control!.setToolTipText("BBjInputE")
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjInputESpinner
control! = window!.addInputESpinner(102,145,10,145,25,list!)
control!.setText("")
control!.setPlaceholder("BBjInputESpinner")
control!.setToolTipText("BBjInputESpinner")
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjInputN
mask$="-###,###,###"
control! = window!.addInputN(103,10,40,125,25,$0000$,mask$,$00$,0,0)
control!.setPlaceholder("BBjInputN")
control!.setToolTipText("BBjInputN mask="+mask$)
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjInputNSpinner
mask$="-###,###,###"
control! = window!.addInputNSpinner(104,145,40,145,25,$0000$,mask$,$00$,0,0)
control!.setPlaceholder("BBjInputNSpinner")
control!.setToolTipText("BBjInputNSpinner mask="+mask$)
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjInputD
control! = window!.addInputD(105,10,70,125,25,$0000$,"",$00$,0,0)
control!.setText("")
control!.setPlaceholder("BBjInputD")
control!.setToolTipText("BBjInputD locale="+stbl("!LOCALE")+" mask="+control!.getMask())
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjInputDSpinner
control! = window!.addInputDSpinner(106,145,70,145,25,$0000$,"",$00$,0,0)
control!.setText("")
control!.setPlaceholder("BBjInputDSpinner")
control!.setToolTipText("BBjInputDSpinner locale="+stbl("!LOCALE")+" mask="+control!.getMask())
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjEditBox
control! = window!.addEditBox(107,10,100,125,25,"",$0000$)
control!.setPlaceholder("BBjEditBox")
control!.setToolTipText("BBjEditBox")
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjEditBoxSpinner
control! = window!.addEditBoxSpinner(108,145,100,145,25,list!)
control!.setText("")
control!.setPlaceholder("BBjEditBoxSpinner")
control!.setToolTipText("BBjEditBoxSpinner")
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjEditBox (Password)
control! = window!.addEditBox(109,10,130,125,25,"",$0400$)
control!.setPlaceholder("BBjEditBox (Password)")
control!.setToolTipText("BBjEditBox (Password)")
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjListEdit
control! = window!.addListEdit(110,145,130,145,145,list$)
control!.setFieldHeight(25)
control!.setPlaceholder("BBjListEdit")
control!.setToolTipText("BBjListEdit")
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
rem ' BBjCEdit
control! = window!.addCEdit(111,10,160,280,50,$$,$0104$)
control!.setPlaceholder("BBjCEdit")
control!.setToolTipText("BBjCEdit")
print control!.getPlaceholder()," ",control!.getPlaceholderColor()
color! = control!.getPlaceholderColor()
chooser! = window!.addColorChooser(199,10,220,455,295,color!)
chooser!.setCallback(chooser!.ON_COLORCHOOSER_CHANGE,"change")
chooser!.setCallback(chooser!.ON_COLORCHOOSER_APPROVE,"approve")
chooser!.setCallback(chooser!.ON_COLORCHOOSER_CANCEL,"cancel")
random! = window!.addButton(1,10,490,125,25,"Random colors",$$)
random!.setCallback(random!.ON_BUTTON_PUSH,"random")
reset! = window!.addButton(2,145,490,125,25,"Reset to defaults",$$)
reset!.setCallback(reset!.ON_BUTTON_PUSH,"reset")
process_events
eoj:
release
change:
  event! = sysgui!.getLastEvent()
  event$ = event!.getEventName()
  print event$,": ",event!.getColor()
return
approve:
  event! = sysgui!.getLastEvent()
  event$ = event!.getEventName()
  print event$,": ",event!.getColor()
  for id = 101 to 111
    control! = window!.getControl(id)
    control!.setPlaceholderColor(event!.getColor())
  next id
return
cancel:
  event! = sysgui!.getLastEvent()
  event$ = event!.getEventName()
  print event$
return
random:
  for id = 101 to 111
    control! = window!.getControl(id)
    color! = bbjapi().makeColor(rnd(255),rnd(255),rnd(255))
    control!.setPlaceholderColor(color!)
  next id
return
reset:
  for id = 101 to 111
    control! = window!.getControl(id)
    control!.setPlaceholderColor(null())
  next id
return
countries:
data "Germany"
data "United States"
end

See Also

BBjAPI

BBjSysGui

BBjControl

Interface TextControl

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.