MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.

I'm not curious

Dynamically access all controls on a window

Published on 04 June 24

Use below code to enable or Disable all controls on a window in PowerBuilder. You can customize this one accordingly.

int li_counter
DataWindow ldw_DataWindow
CommandButton lcb_CommandButton
StaticText lst_StaticText
singleLineEdit ls_singleLineEdit
checkbox lcb_checkbox
picturebutton lpb_picturebutton
editmask lem_editmask
dropdownlistbox lddlb_dropdownlistbox
userObject luo_userobject
radioButton lrb_radiobutton
groupBox lgb_groupBox

for li_counter = 1 to upperbound(control[] )
choose case TypeOf(this.control[li_counter])
case DataWindow!
ldw_DataWindow = this.control[li_counter]
ldw_DataWindow.enabled = false
case CommandButton!
if this.control[li_counter].classname() <> 'cb_cancel' then
lcb_CommandButton = this.control[li_counter]
lcb_CommandButton.enabled = false
end if
case StaticText!
lst_StaticText = this.control[li_counter]
lst_StaticText.enabled = false
lst_StaticText.textColor= 134217745 //Disabled Text Color
case singleLineEdit!
ls_singleLineEdit = this.control[li_counter]
ls_singleLineEdit.enabled = false
case checkbox!
lcb_checkbox = this.control[li_counter]
lcb_checkbox.enabled = false
case picturebutton!
lpb_picturebutton = this.control[li_counter]
lpb_picturebutton.enabled = false
case editmask!
lem_editmask = this.control[li_counter]
lem_editmask.enabled = false
case dropdownlistbox!
lddlb_dropdownlistbox = this.control[li_counter]
lddlb_dropdownlistbox.enabled = false
case userobject!
luo_userobject = this.control[li_counter]
luo_userobject.enabled = false
case radiobutton!
lrb_radiobutton = this.control[li_counter]
lrb_radiobutton.enabled = false
case groupbox!
lgb_groupBox = this.control[li_counter]
lgb_groupBox.enabled = false
lgb_groupBox.textcolor = 134217745
end choose

Related Posts:

Powerbuilder Developer

Post a Comment

Please notify me the replies via email.

  • We hope the conversations that take place on will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
Awards & Accolades for MyTechLogy
Winner of
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url