Changeset 29
- Timestamp:
- 02/20/08 18:12:15 (7 months ago)
- Files:
-
- trunk/win32/dfl/control.d (modified) (9 diffs)
- trunk/win32/dfl/form.d (modified) (3 diffs)
- trunk/win32/dfl/tabcontrol.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/win32/dfl/control.d
r26 r29 3716 3716 3717 3717 3718 private static bool _eachild(HWND hw, bool delegate(HWND hw) callback, inout size_t xiter )3718 private static bool _eachild(HWND hw, bool delegate(HWND hw) callback, inout size_t xiter, bool nested) 3719 3719 { 3720 3720 for(; hw; hw = GetWindow(hw, GW_HWNDNEXT)) … … 3733 3733 return false; 3734 3734 3735 //LONG exst = GetWindowLongA(hw, GWL_EXSTYLE); 3736 //if(exst & WS_EX_CONTROLPARENT) // It's no longer added. 3737 { 3738 HWND hwc = GetWindow(hw, GW_CHILD); 3739 if(hwc) 3740 { 3741 if(!_eachild(hwc, callback, xiter)) 3742 return false; 3735 if(nested) 3736 { 3737 //LONG exst = GetWindowLongA(hw, GWL_EXSTYLE); 3738 //if(exst & WS_EX_CONTROLPARENT) // It's no longer added. 3739 { 3740 HWND hwc = GetWindow(hw, GW_CHILD); 3741 if(hwc) 3742 { 3743 //if(!_eachild(hwc, callback, xiter, nested)) 3744 if(!_eachild(hwc, callback, xiter, true)) 3745 return false; 3746 } 3743 3747 } 3744 3748 } … … 3747 3751 } 3748 3752 3749 package static void eachGoodChildHandle(HWND hw toplevel, bool delegate(HWND hw) callback)3750 { 3751 HWND hw = GetWindow(hw toplevel, GW_CHILD);3753 package static void eachGoodChildHandle(HWND hwparent, bool delegate(HWND hw) callback, bool nested = true) 3754 { 3755 HWND hw = GetWindow(hwparent, GW_CHILD); 3752 3756 size_t xiter = 2000; 3753 _eachild(hw, callback, xiter );3757 _eachild(hw, callback, xiter, nested); 3754 3758 } 3755 3759 … … 3763 3767 3764 3768 package static void _dlgselnext(HWND hwdlg, HWND hwcursel, bool forward, 3765 bool tabStopOnly = true, bool selectableOnly = false) 3766 { 3769 bool tabStopOnly = true, bool selectableOnly = false, 3770 bool nested = true, bool wrap = true, 3771 HWND hwchildrenof = null) 3772 { 3773 if(!hwchildrenof) 3774 hwchildrenof = hwdlg; 3767 3775 if(forward) 3768 3776 { 3769 3777 bool foundthis = false, tdone = false; 3770 3778 HWND hwfirst; 3771 eachGoodChildHandle(hw dlg,3779 eachGoodChildHandle(hwchildrenof, 3772 3780 (HWND hw) 3773 3781 { … … 3798 3806 } 3799 3807 return true; // Continue. 3800 } );3808 }, nested); 3801 3809 if(!tdone && HWND.init != hwfirst) 3802 DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hwfirst, MAKELPARAM(true, 0)); 3810 { 3811 // If it falls through without finding hwcursel, let it select the first one, even if not wrapping. 3812 if(wrap || !foundthis) 3813 { 3814 DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hwfirst, MAKELPARAM(true, 0)); 3815 } 3816 } 3803 3817 } 3804 3818 else 3805 3819 { 3806 3820 HWND hwprev; 3807 eachGoodChildHandle(hw dlg,3821 eachGoodChildHandle(hwchildrenof, 3808 3822 (HWND hw) 3809 3823 { … … 3812 3826 if(HWND.init != hwprev) // Otherwise, keep looping and get last one. 3813 3827 return false; // Break. 3828 if(!wrap) // No wrapping, so don't get last one. 3829 { 3830 assert(HWND.init == hwprev); 3831 return false; // Break. 3832 } 3814 3833 } 3815 3834 if(!tabStopOnly || (GetWindowLongA(hw, GWL_STYLE) & WS_TABSTOP)) … … 3821 3840 } 3822 3841 return true; // Continue. 3823 }); 3842 }, nested); 3843 // If it falls through without finding hwcursel, let it select the last one, even if not wrapping. 3824 3844 if(HWND.init != hwprev) 3825 3845 DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hwprev, MAKELPARAM(true, 0)); 3826 3846 } 3847 } 3848 3849 3850 package final void _selectNextControl(Control ctrltoplevel, 3851 Control ctrl, bool forward, bool tabStopOnly, bool nested, bool wrap) 3852 { 3853 if(!created) 3854 return; 3855 3856 assert(ctrltoplevel !is null); 3857 assert(ctrltoplevel.isHandleCreated); 3858 3859 _dlgselnext(ctrltoplevel.handle, 3860 (ctrl && ctrl.isHandleCreated) ? ctrl.handle : null, 3861 forward, tabStopOnly, !tabStopOnly, nested, wrap, 3862 this.handle); 3863 } 3864 3865 3866 final void selectNextControl(Control ctrl, bool forward, bool tabStopOnly, bool nested, bool wrap) 3867 { 3868 if(!created) 3869 return; 3870 3871 Control ctrltoplevel; 3872 ctrltoplevel = findForm(); 3873 if(ctrltoplevel) 3874 return _selectNextControl(ctrltoplevel, ctrl, forward, tabStopOnly, nested, wrap); 3827 3875 } 3828 3876 … … 6130 6178 wstyle = style; 6131 6179 6132 / +6180 //if((ctrlStyle & ControlStyles.CONTAINER_CONTROL) && (style & WS_CHILD)) 6133 6181 if(style & WS_CHILD) 6134 6182 { 6135 if(exStyle & WS_EX_CONTROLPARENT) 6136 //wstyle = style |= WS_TABSTOP; // Otherwise, Windows could get stuck in an infinite loop ? 6137 wstyle = style |= WS_TABSTOP | WS_GROUP; // ? 6138 } 6139 +/ 6183 exStyle |= WS_EX_CONTROLPARENT; 6184 } 6140 6185 6141 6186 Application.creatingControl(this); … … 7929 7974 private void _init() 7930 7975 { 7931 wexstyle |= WS_EX_CONTROLPARENT;7976 //wexstyle |= WS_EX_CONTROLPARENT; 7932 7977 ctrlStyle |= ControlStyles.CONTAINER_CONTROL; 7933 7978 } trunk/win32/dfl/form.d
r28 r29 2511 2511 2512 2512 case WM_SETFOCUS: 2513 {2514 // Prevent DefDlgProc from getting this message because it'll focus controls it shouldn't.2513 /+ 2514 { 2515 2515 bool didf = false; 2516 2516 enumChildWindows(msg.hWnd, … … 2530 2530 SetFocus(msg.hWnd); 2531 2531 } 2532 +/ 2533 _selectNextControl(this, null, true, true, true, false); 2534 if(!GetFocus()) 2535 focus(); 2536 // Prevent DefDlgProc from getting this message because it'll focus controls it shouldn't. 2532 2537 return; 2533 2538 … … 2826 2831 break; 2827 2832 2828 default: ;2829 }2830 2831 /+2832 switch(m.msg)2833 {2834 case WM_CHAR:2835 // isDialogMessage seems to be eating WM_CHAR in some cases, so see for myself if it should get it.2836 // ? ...2837 return false; // Continue.2838 2839 /+2840 case WM_SYSKEYDOWN:2841 case WM_SYSKEYUP:2842 case WM_SYSCHAR:2843 // isDialogMessage returning true seems to be breaking menu mnemonics.2844 return false; // Continue.2845 +/2846 2847 default: ;2848 }2849 2850 //if(!form.isMdiChild && !form.isMdiContainer)2851 {2852 //if(IsDialogMessageA(form.handle, &m._winMsg))2853 if(dfl.internal.utf.isDialogMessage(form.handle, &m._winMsg))2854 return true; // Prevent.2855 }2856 +/2857 switch(m.msg)2858 {2859 2833 case WM_SYSCHAR: 2860 2834 { trunk/win32/dfl/tabcontrol.d
r16 r29 38 38 { 39 39 Application.ppin(cast(void*)this); 40 41 ctrlStyle |= ControlStyles.CONTAINER_CONTROL; 40 42 41 43 wstyle &= ~WS_VISIBLE;
