Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Karl-Heinz" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: COMBOBOX disabled/readonly colours... Date: Tue, 30 Jan 2018 12:59:16 +0100 Lines: 147 Message-ID: References: <2076e234-6a2d-495c-a815-4b0f775b6e35@googlegroups.com> <58b54495-eba9-4795-85c5-315bd4a69ab7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 8bit X-Trace: individual.net tB70ErDXS6mp/aVHHP9d8wbAMyOdtvriB0gTPVlUcPwjhTHM0= Cancel-Lock: sha1:+7O9XdRHv3dYh3uTXOqmpYz3NM4= In-Reply-To: <58b54495-eba9-4795-85c5-315bd4a69ab7@googlegroups.com> X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 16.4.3564.1216 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3564.1216 Xref: csiph.com comp.lang.clipper.visual-objects:11341 Hi Gregory > I think I solved it other way - I do not disable nor make combobox > readonly (so it stays black/white) but test separate readonly-logic-flag > (I have it anyway) in ListBoxSelect and react respectively if it is set or > not. I use it only for drop-down-list. It´s no good idea to "disable" a control while it still looks like it is enabled. Anyway, here´s a quick shot: i created a CBS_DROPDOWNLIST ComboBox class that does, if the new property Readonly is set to true, some additional "disable" work: - a Mouseclick is rejected and the focus is set to the previous selected control. - jumps to the next Control. If Clipperkeys are set to TRUE, also jumps to the next control. - + jumps to the previous control. Not sure that i found all possibilities to prevent the cmb from gaining the focus ;-) ------------ CLASS cmbDisabled INHERIT combobox PROTECT _lReadOnly AS LOGIC PROTECT _hOwner AS PTR METHOD Dispatch ( oEvent )CLASS cmbDisabled LOCAL hPrev AS PTR IF _lReadOnly DO CASE // prevent Hotcoloring when Themes are enabled CASE oEvent:message == WM_LBUTTONup RETURN SELF:eventReturnValue := 1L CASE oEvent:message == WM_LBUTTONDOWN .OR. oEvent:message == WM_LBUTTONDBLCLK RETURN SELF:eventReturnValue := 1L // prevent Hotcoloring when Themes are enabled CASE oEvent:message == WM_Mousemove RETURN SELF:eventReturnValue := 1L CASE oEvent:message == WM_SETFOCUS DO CASE CASE GetKeyState ( VK_TAB ) < 0 .AND. GetKeyState ( VK_SHIFT ) < 0 // Jump to the previous control PostMessage( _hOwner , WM_NEXTDLGCTL, 1 , 0L ) // If Clipperkeys := true VK_RETURN jumps to the next control too. CASE GetKeyState ( VK_RETURN ) < 0 .OR. GetKeyState ( VK_TAB ) < 0 PostMessage( _hOwner , WM_NEXTDLGCTL, 0 , 0L ) OTHERWISE // jump to the previous selected control hPrev := PTR ( _CAST , oEvent:wParam ) IF hPrev != NULL_PTR SetFocus ( hPrev ) ENDIF ENDCASE RETURN SELF:eventReturnValue := 1L ENDCASE ENDIF RETURN SUPER:Dispatch ( oEvent ) METHOD Init(oOwner, xID, oPoint, oDimension, kComboType, kStyle) CLASS cmbDisabled SUPER:Init(oOwner, xID, oPoint, oDimension, kComboType, kStyle) IF IsInstanceOf(SELF:owner,#DataWindow) _hOwner := SELF:owner:__GetFormSurFace():handle() ELSE _hOwner := SELF:owner:handle() ENDIF RETURN SELF ACCESS ReadOnly CLASS cmbDisabled RETURN _lReadOnly ASSIGN ReadOnly ( lSet ) CLASS cmbDisabled _lReadOnly := lSet RETURN lSet ------------ Happy Combobox opening and closing ;-) regards Karl-Heinz