bb.donnay-software.com

Donnay Software Web Forums
It is currently Sun May 31, 2020 1:05 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Color of DCCHECKBOX
PostPosted: Mon Mar 30, 2020 1:17 am 
Offline

Joined: Mon Jul 28, 2014 1:26 am
Posts: 85
Location: Poznań, Poland
Hi,
is a way to change color of check box in DCCHECKBOX (and in DCRADIOBUTTON)? For example, I want that check box will be yellow when is edit protect, and white (normal) when no. I know, that when use clause WHEN the check box can be grayed, but this is for me not useful.

Regards
Piotr


Top
 Profile  
 
 Post subject: Re: Color of DCCHECKBOX
PostPosted: Mon Mar 30, 2020 1:37 am 
Offline
User avatar

Joined: Thu Jan 28, 2010 12:59 am
Posts: 772
Location: Berlin, Germany
Hi, Piotr.

Just add a COLOR-codeblock:

Code:
@ 1,1 DCCHECKBOX lWhatever PROMPT 'Check this' COLOR {||{GRA_CLR_WHITE,GRA_CLR_RED}} // same with DCRADIO


This will color the text and the background of the checkbox and/or radio button, not the controls themselves.

_________________
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."


Top
 Profile  
 
 Post subject: Re: Color of DCCHECKBOX
PostPosted: Mon Mar 30, 2020 2:20 am 
Offline

Joined: Mon Jul 28, 2014 1:26 am
Posts: 85
Location: Poznań, Poland
Tom,
the COLOR work fine, but only for caption (text). I want change color only for the check box (inside).

Piotr


Top
 Profile  
 
 Post subject: Re: Color of DCCHECKBOX
PostPosted: Mon Mar 30, 2020 6:37 am 
Offline
User avatar

Joined: Thu Jan 28, 2010 12:59 am
Posts: 772
Location: Berlin, Germany
This is something you can't do when working with standard Xbase parts. You will have to use a different control.

_________________
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."


Top
 Profile  
 
 Post subject: Re: Color of DCCHECKBOX
PostPosted: Mon Mar 30, 2020 10:24 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4125
Location: Boise, Idaho USA
You could simulate this by creating a set of bitmaps with different colors.

They would need to look like a checkbox.

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
 Post subject: Re: Color of DCCHECKBOX
PostPosted: Mon Mar 30, 2020 11:46 pm 
Offline
User avatar

Joined: Wed Feb 24, 2010 3:44 pm
Posts: 1183
Piotr D wrote:
the COLOR work fine, but only for caption (text). I want change color only for the check box (inside).

not sure which Part you mean with "inside"
Attachment:
Checkbox_Color.jpg
Checkbox_Color.jpg [ 23.13 KiB | Viewed 2020 times ]

"Check" in Checkbox itself on left side is a Bitmap and depend on visual Style
Frame with Text are Font-Color where Font-Color itself can´t be change
"green" is what i have try "to paint" ... but it is not stable this Way.

what you need is Ownerdraw ... it is "just" a Button.

---

Roger talk about seperat Image to show Status.

as i know Express++ have "PUSHLIKE" Style for Button
Attachment:
DXE_PushLike.jpg
DXE_PushLike.jpg [ 7.82 KiB | Viewed 2020 times ]

this is also possible with Checkbox, Radio and 3-State Button.

_________________
greetings by OHR
Jimmy


Top
 Profile  
 
 Post subject: Re: Color of DCCHECKBOX
PostPosted: Tue Mar 31, 2020 5:21 am 
Offline

Joined: Mon Jul 28, 2014 1:26 am
Posts: 85
Location: Poznań, Poland
Jimmy,
"inside" I understand stricte. I mean about pool inside small frame, a background for check, which is ever white.

Piotr


Top
 Profile  
 
 Post subject: Re: Color of DCCHECKBOX
PostPosted: Tue Mar 31, 2020 5:38 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4125
Location: Boise, Idaho USA
Piotr -

Now that I am locked down in my apartment I have few activities that preserve my interests, therefore this little challenge sounds like something that is welcomed. I will write you a sample program.

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
 Post subject: Re: Color of DCCHECKBOX
PostPosted: Tue Mar 31, 2020 8:24 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4125
Location: Boise, Idaho USA
Here is the sample program that I promised (no bitmaps required) :
Code:
#INCLUDE "dcdialog.CH"
#INCLUDE "dcbitmap.CH"
#INCLUDE "appevent.CH"

#command @ <row>, <col> CHECKBUTTON <checked> CAPTION <caption>;
   => CheckButton( GetList, <row>, <col>, @<checked>, <caption> )


FUNCTION Main()

LOCAL GetList[0], lCheck1 := .f., lCheck2 := .f., lCheck3 := .t.

@0,0 DCSAY 'Check Buttons:' SAYSIZE 0 FONT '10.Arial'

@2,0 CHECKBUTTON lCheck1 CAPTION 'Check me First'

@4,0 CHECKBUTTON lCheck2 CAPTION 'Check me Next'

@6,0 CHECKBUTTON lCheck3 CAPTION 'Check me Last'

DCREAD GUI FIT TITLE 'Check Button Test'

RETURN nil

* ---------

FUNCTION CheckButton( GetList, nRow, nCol, lChecked, cCaption )

LOCAL oButton

@ nRow, nCol DCPUSHBUTTONXP ;
      CAPTION {|| IIF(lChecked,'4',' ')} ;
      SIZE 5,1.8 ;
      ACTION {|a,b,o|lChecked := !lChecked, ;
                     o:setCaption(IIF(lChecked,'4',' ')), ;
                     o:bgColor := IIF(lChecked,GRA_CLR_YELLOW,GRA_CLR_WHITE ), ;
                     o:invalidateRect() } ;
      OBJECT oButton ;
      FONT '26.ZapFDingBats' ;
      GRADIENT 1 REVERSE ;
      COLOR nil, IIF(lChecked,GRA_CLR_YELLOW,GRA_CLR_WHITE) ;
      CLICKCOLOR nil, GRA_CLR_WHITE ;
      BORDERCOLOR GRA_CLR_BLACK ;
      RADIUS 10 ;
      FOCUSRECT 0

@ DCGUI_ROW, DCGUI_COL + 10 DCSAY cCaption SAYSIZE 0 ;
      FONT '16.Arial' ;
      EVAL {|o|o:lbClick := {||Eval(oButton:activate)}}

RETURN nil

* ---------

PROC appsys ; RETURN


Attachments:
CheckButton.jpg
CheckButton.jpg [ 20.83 KiB | Viewed 2002 times ]

_________________
The eXpress train is coming - and it has more cars.
Top
 Profile  
 
 Post subject: Re: Color of DCCHECKBOX
PostPosted: Tue Mar 31, 2020 10:26 am 
Offline

Joined: Mon Jul 28, 2014 1:26 am
Posts: 85
Location: Poznań, Poland
Roger,
Thank you for that tips. This is probably the only right way to achieve the effect I expect. You are (as always) great. I wish you good health.

Regards
Piotr


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group