how to colorize the background of "controlStaticText"

Discussions related to Visual Prolog
marco62118
VIP Member
Posts: 88
Joined: 16 Feb 2011 19:21

how to colorize the background of "controlStaticText"

Unread post by marco62118 » 25 Oct 2011 14:12

hello
how to colorize the background of "controlStaticText" in the same idea, how to colorize the font color of a control
Novice, very novice in Visual Prolog and even poorer in English

User avatar
Tonton Luc
VIP Member
Posts: 500
Joined: 16 Oct 2001 23:01

Unread post by Tonton Luc » 26 Oct 2011 10:52

Hi Marco,

One way :

1) add a new draw control in your project (by IDE)

2) add a paint responder in this draw control (by IDE)

3) add this code on the onPaint of your draw control :

Code: Select all

predicates     onPaint : drawWindow::paintResponder. clauses     onPaint(_Source, Rectangle, GDI):-         GDI:clear(color_red), % backgroundcolor         GDI:setForeColor(color_LightBlue),                 GDI:drawTextInRect(Rectangle,"my own text here",[dtext_SingleLine,dtext_Center,dtext_Wordbreak])
4) add a new Custom control in your Form (or Dialog) and choose your own draw control class from the list proposed by IDE

5) compile your project and test it.

marco62118
VIP Member
Posts: 88
Joined: 16 Feb 2011 19:21

Unread post by marco62118 » 26 Oct 2011 12:19

hello

J have create a new "draw control" but i cannot
2) add a paint responder in this draw control (by IDE)
the column events is empty, same after rebuild all
Novice, very novice in Visual Prolog and even poorer in English

marco62118
VIP Member
Posts: 88
Joined: 16 Feb 2011 19:21

Unread post by marco62118 » 26 Oct 2011 12:21

excuse me
after restart of my program it is resolve
Novice, very novice in Visual Prolog and even poorer in English

marco62118
VIP Member
Posts: 88
Joined: 16 Feb 2011 19:21

Unread post by marco62118 » 26 Oct 2011 13:22

if I understand it is possible todraw because the control have a paint reponder!!!
but on button control it is impossible to change the color of background
Novice, very novice in Visual Prolog and even poorer in English

Steve Lympany
VIP Member
Posts: 119
Joined: 31 Mar 2001 23:01

Unread post by Steve Lympany » 26 Oct 2011 14:33

Hi,
1) See
http://discuss.visual-prolog.com/viewtopic.php?t=7329
2) I don't know what your application will be, but it is probably not a good idea to override the end-users' Windows colour settings (that they prefer). Generally, it is best to use the default settings, except in special circumstances.
cheers
Steve

User avatar
Tonton Luc
VIP Member
Posts: 500
Joined: 16 Oct 2001 23:01

Re:

Unread post by Tonton Luc » 26 Oct 2011 16:41

The eButtons package is available here : http://www.arsaniit.com/fr/prolog-tools ... ebuttonsfr
It's a french site, Marco :wink:

marco62118
VIP Member
Posts: 88
Joined: 16 Feb 2011 19:21

Unread post by marco62118 » 26 Oct 2011 17:13

hi
I wanted colored a control to identify a player on my form!
I create a frame blue color per player.
when the game is launched the donor is appointed and I wanted to change the frame color or background color of the frame but nothing I still have the same color

Code: Select all

        predicates     onPaint : drawWindow::paintResponder. clauses     onPaint(_Source, _Rectangle, GDI):-                 CadreTableP=cadreTableP(),                                  stdio::write(CadreTableP), %(5-5-1275-904)                   GDI:setPen(pen(1, ps_solid, color_Blue)),                    GDI:drawRect(CadreTableP),                 foreach I=std::fromTo(1,4) do                         conversion::convNumNom(I,NameJoueur),                          mainJoueur::get1CadreMainJoueur(NameJoueur,CadreMainJoueur),                        Donneur=(jeu::getDonneur()),                         if NameJoueur=Donneur then                                 GDI:setPen(pen(2, ps_solid, color_Red)),                                   GDI:drawRect(CadreMainJoueur)                         else                                 GDI:setPen(pen(1, ps_solid, color_Blue)),                                  GDI:drawRect(CadreMainJoueur)                         end if                                      end foreach.
Novice, very novice in Visual Prolog and even poorer in English

User avatar
Tonton Luc
VIP Member
Posts: 500
Joined: 16 Oct 2001 23:01

Unread post by Tonton Luc » 27 Oct 2011 18:28

Hi,
Maybe try this :

Code: Select all

clauses     onPaint(_Source, _Rectangle, GDI):-         CadreTableP=cadreTableP(),               stdio::write(CadreTableP), %(5-5-1275-904)         GDI:setPen(pen(1, ps_solid, color_Blue)),         GDI:setBrush(brush(pat_Solid,color_Blue)),         GDI:drawRect(CadreTableP),         foreach I=std::fromTo(1,4) do             conversion::convNumNom(I,NameJoueur),             mainJoueur::get1CadreMainJoueur(NameJoueur,CadreMainJoueur),             if NameJoueur=jeu::getDonneur() then                 Couleur = color_Red             else                 Couleur = color_Blue             end if,             GDI:setPen(pen(2, ps_solid, Couleur)),               GDI:setBrush(brush(pat_Solid,Couleur)),             GDI:drawRect(CadreMainJoueur)         end foreach.

marco62118
VIP Member
Posts: 88
Joined: 16 Feb 2011 19:21

Unread post by marco62118 » 27 Oct 2011 22:49

hello
it is the same, the color don't change, after a first drawing in color blue , for the second drawing the color is unchanged
Novice, very novice in Visual Prolog and even poorer in English

Post Reply