checkbox - How to enable button according to the number of checked checkboxes powerbuilder? -


i have datawindow checkboxes , button 'ok'. button disabled until @ least 1 of checkboxes checked. problem if have more 1 checkbox checked , want uncheck 1 button disables. wrote code in itemchanged event:

int li_ind long    ll_row  choose case dwo.name     case "ind"         row = 1 this.rowcount()             if  data ='1'                       li_ind++             end if         next          if li_ind <> 0             parent.cb_ok.enabled = true         else             parent.cb_ok.enabled = false         end if  end choose 

what doing wrong?

thanks!

you put hidden computed field in detail band of datawindow named cf_ind_count.

define cf_ind_count

sum( if( ind = '1', 1, 0 ) ) 

replace script with

long ll_count long ll_rows boolean lb_enable = false  ll_rows = this.rowcount()  if ll_rows < 1     lb_enable = false else     ll_count = long( this.object.cf_ind_count[1] )     if ll_count > 0         lb_enable = true     else         lb_enable = false     end if end if  parent.cb_ok.enable = lb_enable 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -