Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #11341

Re: COMBOBOX disabled/readonly colours...

From "Karl-Heinz" <invalid@invalid.invalid>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: COMBOBOX disabled/readonly colours...
Date 2018-01-30 12:59 +0100
Message-ID <fdb50tF47hiU1@mid.individual.net> (permalink)
References <2076e234-6a2d-495c-a815-4b0f775b6e35@googlegroups.com> <p4nlnm$157t$2@gioia.aioe.org> <58b54495-eba9-4795-85c5-315bd4a69ab7@googlegroups.com>

Show all headers | View raw


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.

- <TAB> jumps to the next Control. If Clipperkeys are set to TRUE, <RETURN>
also jumps to the next control.

- <SHIFT> + <TAB> 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 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

COMBOBOX disabled/readonly colours... "Grzegorz R." <ramotny64@gmail.com> - 2018-01-28 11:24 -0800
  Re: COMBOBOX disabled/readonly colours... Arne Ortlinghaus <Arne.Ortlinghaus@acs.it> - 2018-01-29 18:30 +0100
    Re: COMBOBOX disabled/readonly colours... "Grzegorz R." <ramotny64@gmail.com> - 2018-01-30 00:02 -0800
      Re: COMBOBOX disabled/readonly colours... "Karl-Heinz" <invalid@invalid.invalid> - 2018-01-30 12:59 +0100
        Re: COMBOBOX disabled/readonly colours... "Karl-Heinz" <invalid@invalid.invalid> - 2018-01-30 18:57 +0100

csiph-web