以下の違いを無視:
日時:
2024/06/23 17:46:46 (3ヵ月前)
更新者:
hizuya@…
ログメッセージ:
  • 先頭のチェックボックスが非表示の場合に、正しくそれを対象とするように修正。
ファイル:
1個の更新

凡例:

未変更
追加
削除
  • framework/trunk/WebLibrary/Sources/UI/WebControls/SelectField.cs

    r1651 r1652  
    569569 
    570570 
     571        // FIXME Reflections に移す 
     572 
    571573        /// <summary> 
    572574        /// <see cref="RadioButtonIdSeparatorAccessor"/> フィールドの値を取得します。 
     
    675677        private static ICheckBoxControl FindCheckBoxControl(ControlCollection controls, bool visibleOnly) 
    676678        { 
     679            bool isVisible; 
     680            ICheckBoxControl checkBoxControl = FindCheckBoxControl(controls, out isVisible); 
     681            return !visibleOnly || isVisible 
     682                ? checkBoxControl 
     683                : null; 
     684        } 
     685 
     686        /// <summary> 
     687        /// コントロールコレクションから最初に見付かった <see cref="ICheckBoxControl"/> を返します。 
     688        /// </summary> 
     689        /// <param name="controls">コントロールコレクション。</param> 
     690        /// <param name="isVisible"> 
     691        /// <see cref="ICheckBoxControl"/> が見付かった場合で表示中の場合は <see langword="true"/>。 
     692        /// それ以外の場合は <see langword="false"/>。 
     693        /// </param> 
     694        /// <returns> 
     695        /// コントロールコレクションから最初に見付かった <see cref="ICheckBoxControl"/>。 
     696        /// 存在しない場合は <see langword="null"/>。 
     697        /// </returns> 
     698        private static ICheckBoxControl FindCheckBoxControl(ControlCollection controls, out bool isVisible) 
     699        { 
    677700            if (controls == null || controls.Count == 0) 
    678701            { 
     702                isVisible = false; 
    679703                return null; 
    680704            } 
     
    682706            foreach (Control control in controls) 
    683707            { 
    684                 // 非表示の場合は無視 
    685                 if (visibleOnly && !control.Visible) 
    686                 { 
    687                     continue; 
    688                 } 
    689  
    690                 ICheckBoxControl checkBoxControl 
    691                     = control as ICheckBoxControl 
    692                         ?? FindCheckBoxControl(control.Controls, visibleOnly); 
     708                // ICheckBoxControl の場合 
     709                ICheckBoxControl checkBoxControl = control as ICheckBoxControl; 
    693710                if (checkBoxControl != null) 
    694711                { 
     712                    isVisible = control.Visible; 
    695713                    return checkBoxControl; 
    696714                } 
    697             } 
    698  
     715 
     716                // 子孫に ICheckBoxControl を持つ場合 
     717                bool childIsVisible; 
     718                checkBoxControl = FindCheckBoxControl(control.Controls, out childIsVisible); 
     719                if (checkBoxControl != null) 
     720                { 
     721                    isVisible = childIsVisible && control.Visible; 
     722                    return checkBoxControl; 
     723                } 
     724            } 
     725 
     726            isVisible = false; 
    699727            return null; 
    700728        } 
詳しい使い方は TracChangeset を参照してください。