Changeset 25
- Timestamp:
- 02/19/08 19:33:40 (7 months ago)
- Files:
-
- trunk/win32/dfl/control.d (modified) (3 diffs)
- trunk/win32/dfl/form.d (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/win32/dfl/control.d
r22 r25 969 969 private void _ctrladded(ControlEventArgs cea) 970 970 { 971 /+ 971 972 if(!(_exStyle() & WS_EX_CONTROLPARENT)) 972 973 { 973 //if(_style() & WS_CHILD)974 974 if(!(cbits & CBits.FORM)) 975 _exStyle(_exStyle() | WS_EX_CONTROLPARENT); 976 } 975 { 976 //if((cea.control._style() & WS_TABSTOP) || (cea.control._exStyle() & WS_EX_CONTROLPARENT)) 977 _exStyle(_exStyle() | WS_EX_CONTROLPARENT); 978 } 979 } 980 +/ 977 981 978 982 onControlAdded(cea); … … 3710 3714 3711 3715 3716 private static bool _eachild(HWND hw, bool delegate(HWND hw) callback, inout size_t xiter) 3717 { 3718 for(; hw; hw = GetWindow(hw, GW_HWNDNEXT)) 3719 { 3720 if(!xiter) 3721 return false; 3722 xiter--; 3723 3724 LONG st = GetWindowLongA(hw, GWL_STYLE); 3725 if(!(st & WS_VISIBLE)) 3726 continue; 3727 if(st & WS_DISABLED) 3728 continue; 3729 3730 if(!callback(hw)) 3731 return false; 3732 3733 //LONG exst = GetWindowLongA(hw, GWL_EXSTYLE); 3734 //if(exst & WS_EX_CONTROLPARENT) // It's no longer added. 3735 { 3736 HWND hwc = GetWindow(hw, GW_CHILD); 3737 if(hwc) 3738 { 3739 if(!_eachild(hwc, callback, xiter)) 3740 return false; 3741 } 3742 } 3743 } 3744 return true; 3745 } 3746 3747 package static void eachGoodChildHandle(HWND hwtoplevel, bool delegate(HWND hw) callback) 3748 { 3749 HWND hw = GetWindow(hwtoplevel, GW_CHILD); 3750 size_t xiter = 2000; 3751 _eachild(hw, callback, xiter); 3752 } 3753 3754 3755 package static void _dlgselnext(HWND hwdlg, HWND hwcursel, bool forward) 3756 { 3757 if(forward) 3758 { 3759 bool foundthis = false, tdone = false; 3760 HWND hwfirst; 3761 eachGoodChildHandle(hwdlg, 3762 (HWND hw) 3763 { 3764 if(hw == hwcursel) 3765 { 3766 foundthis = true; 3767 } 3768 else 3769 { 3770 LONG st = GetWindowLongA(hw, GWL_STYLE); 3771 if(st & WS_TABSTOP) 3772 { 3773 if(foundthis) 3774 { 3775 DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hw, MAKELPARAM(true, 0)); 3776 tdone = true; 3777 return false; // Break. 3778 } 3779 else 3780 { 3781 if(HWND.init == hwfirst) 3782 hwfirst = hw; 3783 } 3784 } 3785 } 3786 return true; // Continue. 3787 }); 3788 if(!tdone && HWND.init != hwfirst) 3789 DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hwfirst, MAKELPARAM(true, 0)); 3790 } 3791 else 3792 { 3793 HWND hwprev; 3794 eachGoodChildHandle(hwdlg, 3795 (HWND hw) 3796 { 3797 if(hw == hwcursel) 3798 { 3799 if(HWND.init != hwprev) // Otherwise, keep looping and get last one. 3800 return false; // Break. 3801 } 3802 LONG st = GetWindowLongA(hw, GWL_STYLE); 3803 if(st & WS_TABSTOP) 3804 hwprev = hw; 3805 return true; // Continue. 3806 }); 3807 if(HWND.init != hwprev) 3808 DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hwprev, MAKELPARAM(true, 0)); 3809 } 3810 } 3811 3812 3712 3813 /// 3713 3814 final void select() … … 3726 3827 return; 3727 3828 3728 // To-do: check if correct implementation.3729 Control ctrl;3730 ctrl = findForm();3731 if(ctrl && ctrl !is this)3732 {3829 Control ctrltoplevel; 3830 ctrltoplevel = findForm(); 3831 if(ctrltoplevel && ctrltoplevel !is this) 3832 { 3833 /+ // Old... 3733 3834 // Even if directed, ensure THIS one is selected first. 3734 3835 if(!directed || hwnd != GetFocus()) 3735 3836 { 3736 DefDlgProcA(ctrl .handle, WM_NEXTDLGCTL, cast(WPARAM)hwnd, MAKELPARAM(true, 0));3837 DefDlgProcA(ctrltoplevel.handle, WM_NEXTDLGCTL, cast(WPARAM)hwnd, MAKELPARAM(true, 0)); 3737 3838 } 3738 3839 3739 3840 if(directed) 3740 3841 { 3741 DefDlgProcA(ctrl.handle, WM_NEXTDLGCTL, !forward, MAKELPARAM(false, 0)); 3842 DefDlgProcA(ctrltoplevel.handle, WM_NEXTDLGCTL, !forward, MAKELPARAM(false, 0)); 3843 } 3844 +/ 3845 3846 if(directed) 3847 { 3848 _dlgselnext(ctrltoplevel.handle, this.handle, forward); 3849 } 3850 else 3851 { 3852 DefDlgProcA(ctrltoplevel.handle, WM_NEXTDLGCTL, cast(WPARAM)this.handle, MAKELPARAM(true, 0)); 3742 3853 } 3743 3854 } trunk/win32/dfl/form.d
r24 r25 2770 2770 if(WM_KEYDOWN == m.msg) 2771 2771 { 2772 /+2773 Message mm;2774 mm.hWnd = form.handle;2775 mm.msg = WM_NEXTDLGCTL;2776 mm.lParam = MAKEWPARAM(FALSE, 0); // wParam is direction.2777 2772 if(GetKeyState(VK_SHIFT) & 0x8000) 2778 mm.wParam = 1; 2773 { 2774 // Backwards... 2775 //DefDlgProcA(form.handle, WM_NEXTDLGCTL, 1, MAKELPARAM(FALSE, 0)); 2776 _dlgselnext(form.handle, m.hWnd, false); 2777 } 2779 2778 else 2780 mm.wParam = 0; 2781 form.wndProc(mm); 2782 +/ 2783 if(GetKeyState(VK_SHIFT) & 0x8000) 2784 DefDlgProcA(form.handle, WM_NEXTDLGCTL, 1, MAKELPARAM(FALSE, 0)); 2785 else 2786 DefDlgProcA(form.handle, WM_NEXTDLGCTL, 0, MAKELPARAM(FALSE, 0)); 2779 { 2780 // Forwards... 2781 //DefDlgProcA(form.handle, WM_NEXTDLGCTL, 0, MAKELPARAM(FALSE, 0)); 2782 _dlgselnext(form.handle, m.hWnd, true); 2783 } 2787 2784 } 2788 2785 return true; // Prevent. … … 2835 2832 +/ 2836 2833 +/ 2837 2838 size_t xiter;2839 bool _eachild(HWND hw, bool delegate(HWND hw) callback)2840 {2841 for(; hw; hw = GetWindow(hw, GW_HWNDNEXT))2842 {2843 if(!xiter)2844 return false;2845 xiter--;2846 2847 LONG st = GetWindowLongA(hw, GWL_STYLE);2848 if(!(st & WS_VISIBLE))2849 continue;2850 if(st & WS_DISABLED)2851 continue;2852 2853 if(!callback(hw))2854 return false;2855 2856 LONG exst = GetWindowLongA(hw, GWL_EXSTYLE);2857 if(exst & WS_EX_CONTROLPARENT)2858 {2859 HWND hwc = GetWindow(hw, GW_CHILD);2860 if(hwc)2861 {2862 if(!_eachild(hwc, callback))2863 return false;2864 }2865 }2866 }2867 return true;2868 }2869 2870 void eachGoodChild(bool delegate(HWND hw) callback)2871 {2872 HWND hw = GetWindow(form.handle, GW_CHILD);2873 xiter = 2000;2874 _eachild(hw, callback);2875 }2876 2834 2877 2835 bool pmnemonic(HWND hw) … … 2890 2848 bool foundmhw = false; 2891 2849 bool foundmn = false; 2892 eachGoodChild (2850 eachGoodChildHandle(form.handle, 2893 2851 (HWND hw) 2894 2852 { … … 2914 2872 { 2915 2873 // Didn't find current control, so go from top-to-bottom. 2916 eachGoodChild (2874 eachGoodChildHandle(form.handle, 2917 2875 (HWND hw) 2918 2876 { … … 2928 2886 { 2929 2887 // Didn't find mnemonic after current control, so go from top-to-this. 2930 eachGoodChild (2888 eachGoodChildHandle(form.handle, 2931 2889 (HWND hw) 2932 2890 {
