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


Groups > comp.lang.clipper.visual-objects > #11328 > unrolled thread

COMBOBOX disabled/readonly colours...

Started by"Grzegorz R." <ramotny64@gmail.com>
First post2018-01-28 11:24 -0800
Last post2018-01-30 18:57 +0100
Articles 5 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  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

#11328 — COMBOBOX disabled/readonly colours...

From"Grzegorz R." <ramotny64@gmail.com>
Date2018-01-28 11:24 -0800
SubjectCOMBOBOX disabled/readonly colours...
Message-ID<2076e234-6a2d-495c-a815-4b0f775b6e35@googlegroups.com>
Hello Friends,

default colors for readonly Combobox is darkgray/lightgray instead of black/lightgray as in SLE's. Is there any way to force Readonly (or disabled) Comboxbox to display black/lightgray?

Best regards
Gregory

[toc] | [next] | [standalone]


#11334

FromArne Ortlinghaus <Arne.Ortlinghaus@acs.it>
Date2018-01-29 18:30 +0100
Message-ID<p4nlnm$157t$2@gioia.aioe.org>
In reply to#11328
Hi Gregory,
I haven't found any standard possibility until now. It is disturbing 
that the control contents is nearly impossible to read when it is disabled.

I believe that is possible with owner drawn comboxboxes.
Karl-Heinz Rauscher published some code many years ago. If you send me 
your email address I can send you the AEF.

Arne Ortlinghaus

Grzegorz R. wrote:
> Hello Friends,
> 
> default colors for readonly Combobox is darkgray/lightgray instead of black/lightgray as in SLE's. Is there any way to force Readonly (or disabled) Comboxbox to display black/lightgray?
> 
> Best regards
> Gregory
> 

[toc] | [prev] | [next] | [standalone]


#11340

From"Grzegorz R." <ramotny64@gmail.com>
Date2018-01-30 00:02 -0800
Message-ID<58b54495-eba9-4795-85c5-315bd4a69ab7@googlegroups.com>
In reply to#11334
W dniu poniedziałek, 29 stycznia 2018 18:30:32 UTC+1 użytkownik Arne Ortlinghaus napisał:
> Hi Gregory,
> I haven't found any standard possibility until now. It is disturbing 
> that the control contents is nearly impossible to read when it is disabled.
> 
> I believe that is possible with owner drawn comboxboxes.
> Karl-Heinz Rauscher published some code many years ago. If you send me 
> your email address I can send you the AEF.
> 
> Arne Ortlinghaus
> 
> Grzegorz R. wrote:
> > Hello Friends,
> > 
> > default colors for readonly Combobox is darkgray/lightgray instead of black/lightgray as in SLE's. Is there any way to force Readonly (or disabled) Comboxbox to display black/lightgray?
> > 
> > Best regards
> > Gregory
> >

Hello Arne

try RAMOTNY(monkey)INTERIA(dot)PL

Thank You in advance...

---

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.

METHOD ListBoxSelect(oControlEvent) CLASS MyWindow
  LOCAL oControl AS OBJECT
  LOCAL oEvent AS ControlEvent

  oEvent:=oControlEvent
  oControl := IIF(oControlEvent == NULL_OBJECT, NULL_OBJECT, oEvent:Control)

  IF SELF:lReadOnly
    WarningBox{SELF,"Warning!","Turn EDIT on!"}:Show()
  ELSE
    SUPER:ListBoxSelect(oEvent)
    IF oControl:NameSym==#cbMyCombo
    .....
    (further other actions if not readonly = select enabled)

This is workaround but works for me :)
Greg

---

Best regards
Gregory

[toc] | [prev] | [next] | [standalone]


#11341

From"Karl-Heinz" <invalid@invalid.invalid>
Date2018-01-30 12:59 +0100
Message-ID<fdb50tF47hiU1@mid.individual.net>
In reply to#11340
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 

[toc] | [prev] | [next] | [standalone]


#11342

From"Karl-Heinz" <invalid@invalid.invalid>
Date2018-01-30 18:57 +0100
Message-ID<fdbq01F91qcU1@mid.individual.net>
In reply to#11341
Hi Gregory

if you don´t include the manifest resource file in your app you might try
the modified Readonly assign below.The Idea behind: Because the class
prevents a focus selection as soon Readonly is set to true, it´s possible to
switch the Background and Textcolor at that moment. Sure, the button down
symbol isn´t shown in disabled mode than, but at least you´re able to change
the colors without the need to draw the complete combobox yourself.


ASSIGN ReadOnly ( lSet ) CLASS cmbDisabled

_lReadOnly := lSet

IF _lReadOnly

    SELF:Background := Brush { Color { GetSysColor ( COLOR_BTNFACE )  } }
    SELF:TextColor := Color { GetSysColor ( COLOR_BTNTEXT ) }

ELSE

    SELF:Background := Brush { Color { GetSysColor ( COLOR_WINDOW ) } }
     SELF:TextColor := Color { GetSysColor ( COLOR_BTNTEXT ) }

ENDIF


RETURN lSet


BTW: It´s a complete different story if your app is themed.


regards
Karl-Heinz 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web