change color checkboxex on line

change color checkboxex on line

Postby Silvio.Falconi » Tue Nov 12, 2024 12:39 pm

I need to change the color of Prompt if it is checked I made ( but not work)

Code: Select all  Expand view

@ nRow, ncol CHECKBOX aChk[1]   PROMPT aRuote[1]  SIZE 85, 20 PIXEL  of oDlg COLOR CLR_BLACK, CLR_WHITE   ;
   ON CHANGE ( lBa := !lBa,IIF(aChk[1]:lChecked(), aChk[1]:SetColor( CLR_WHITE, CLR_BLUE ),;
                               aChk[1]:SetColor( CLR_BLACK, CLR_WHITE )),aChk[1]:refresh()) UPDATE
 



any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: change color checkboxex on line

Postby Detlef » Tue Nov 12, 2024 9:57 pm

Hi Silvio,

here a strange eample:
Code: Select all  Expand view
#include "fivewin.ch"


Function main()
   local oWnd
   local lChk := .f., oChk

   DEFINE WINDOW  oWnd

      @ 5, 12 CHECKBOX oChk VAR lChk;
         PROMPT "hi there";
         SIZE 85, 20 PIXEL;
         OF oWnd COLOR CLR_BLACK, CLR_WHITE ;
         ON CHANGE colorize( oChk, oWnd )

   ACTIVATE WINDOW oWnd

return nil

Function colorize( o, w )

   if eval( o:bSetGet )
      o:nClrText := CLR_WHITE
      o:nClrPane := CLR_BLUE
   else
      o:nClrText := CLR_BLACK
      o:nClrPane := CLR_WHITE
   endif

   // try to comment the line below
   msginfo( "msgPaint :-))" )
return nil
 


if you put msginfo ( ... ) as comment the color change doesn't work.
I don't know why.

Regards, Detlef
User avatar
Detlef
 
Posts: 209
Joined: Mon Feb 07, 2022 9:54 pm

Re: change color checkboxex on line

Postby Silvio.Falconi » Wed Nov 13, 2024 7:51 am

Detlef wrote:Hi Silvio,

here a strange eample:
Code: Select all  Expand view
#include "fivewin.ch"


Function main()
   local oWnd
   local lChk := .f., oChk

   DEFINE WINDOW  oWnd

      @ 5, 12 CHECKBOX oChk VAR lChk;
         PROMPT "hi there";
         SIZE 85, 20 PIXEL;
         OF oWnd COLOR CLR_BLACK, CLR_WHITE ;
         ON CHANGE colorize( oChk, oWnd )

   ACTIVATE WINDOW oWnd

return nil

Function colorize( o, w )

   if eval( o:bSetGet )
      o:nClrText := CLR_WHITE
      o:nClrPane := CLR_BLUE
   else
      o:nClrText := CLR_BLACK
      o:nClrPane := CLR_WHITE
   endif

   // try to comment the line below
   msginfo( "msgPaint :-))" )
return nil
 


if you put msginfo ( ... ) as comment the color change doesn't work.
I don't know why.

Regards, Detlef

nice
I tried with lchecked I saw on the class is METHOD lChecked() INLINE Eval( ::bSetGet ) and not understood why not worked


Now I tried on my dialog and not run !!

Code: Select all  Expand view

   @ nRow, nCol CHECKBOX aGetRuote[1] VAR aChk PROMPT aRuote[1] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE  ON CHANGE colorize( aGetRuote[1], oDlg


Image


try the test
Code: Select all  Expand view
#include "fivewin.ch"
#include "constant.ch"

Function main()
   local oDlg,oFont,oBold
   local aChk:={}
   local aGetRuote:= array(11)
   Local aRuote  := {"Bari","Cagliari","Firenze","Genova",;
                   "Milano","Napoli","Palermo","Roma","Torino",;
                   "Venezia","Nazionale"}
   local nRow:= 10
   local nCol:= 5
   local nInterlinea:= 20

 local nBottom   := 33
 local nRight    := 99
 local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
 local nHeight := nBottom * DLG_CHARPIX_H

    For n= 1 to Len( aRuote)
      aadd(aChk,{.f.,aRuote[n]})
    next

   DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 14
   DEFINE FONT oBold NAME "MS Sans Serif" SIZE 0, 12 BOLD
   DEFINE DIALOG  oDlg ;
      SIZE nWidth, nHeight  PIXEL TRUEPIXEL RESIZABLE ;
      TITLE "colorize check"     COLOR 0, CLR_WHITE FONT oFont


      @ nRow, nCol CHECKBOX aGetRuote[1] VAR aChk[1][1];
      PROMPT aRuote[1] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[1], oDlg )  UPDATE
      nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[2] VAR aChk[2][1];
      PROMPT aRuote[2] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[2], oDlg ) UPDATE
       nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[3] VAR aChk[3][1];
      PROMPT aRuote[3] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[3], oDlg ) UPDATE
        nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[4] VAR aChk[4][1];
      PROMPT aRuote[4] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[4], oDlg ) UPDATE
        nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[5] VAR aChk[5][1];
      PROMPT aRuote[5] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[5], oDlg ) UPDATE
       nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[6] VAR aChk[6][1];
      PROMPT aRuote[6] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[6], oDlg ) UPDATE
      nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[7] VAR aChk[7][1];
      PROMPT aRuote[7] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[7], oDlg ) UPDATE
       nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[8] VAR aChk[8][1];
      PROMPT aRuote[8] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[8], oDlg ) UPDATE
       nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[9] VAR aChk[9][1];
      PROMPT aRuote[9] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[9], oDlg ) UPDATE
       nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[10] VAR aChk[10][1];
      PROMPT aRuote[10] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[10], oDlg ) UPDATE
      nRow+=nInterlinea
       @ nRow, nCol CHECKBOX aGetRuote[11] VAR aChk[11][1];
      PROMPT aRuote[11] SIZE 85, 20 PIXEL OF oDlg COLOR CLR_BLACK, CLR_WHITE ;
      ON CHANGE colorize( aGetRuote[11], oDlg ) UPDATE


       ACTIVATE DIALOG oDlg

return nil

Function colorize( o, w )

   if eval( o:bSetGet )
      o:nClrText := CLR_WHITE
      o:nClrPane := CLR_BLUE
   else
      o:nClrText := CLR_BLACK
      o:nClrPane := CLR_WHITE
   endif

   // try to comment the line below
 *  msginfo( "msgPaint :-))" )
return nil
 


If Rem msginfo( "msgPaint :-))" ) not work !!!
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: change color checkboxex on line

Postby Silvio.Falconi » Wed Nov 13, 2024 8:37 am

resolved on test above I add w:refresh(.f.) instead of message
even if in my dialog it still doesn't work and I don't understand why
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter and 19 guests