Page 1 of 1

How to change background color of a standard Dialog without making custom control Dialog

Posted: 1 Dec 2021 0:31
by abdelrahman
my dear friends ,
i want to change the background color of standard dialog without making custom control
the following is dialog. pro contents
what should i write to change background color and where to write it ?????

Code: Select all

implement color_dialog inherits dialog     open core, vpiDomains   clauses     display(Parent) = Dialog :-         Dialog = new(Parent),         Dialog:show().   clauses     new(Parent) :-         dialog::new(Parent),         generatedInitialize().   % This code is maintained automatically, do not update it manually. facts     ok_ctl : button.     cancel_ctl : button.     help_ctl : button.   predicates     generatedInitialize : (). clauses     generatedInitialize() :-         setText("color_dialog"),         setRect(rct(50, 40, 290, 160)),         setModal(true),         setDecoration(titlebar([frameDecoration::closeButton])),         ok_ctl := button::newOk(This),         ok_ctl:setText("&OK"),         ok_ctl:setPosition(48, 98),         ok_ctl:setSize(56, 16),         ok_ctl:defaultHeight := false,         ok_ctl:setAnchors([control::right, control::bottom]),         cancel_ctl := button::newCancel(This),         cancel_ctl:setText("Cancel"),         cancel_ctl:setPosition(112, 98),         cancel_ctl:setSize(56, 16),         cancel_ctl:defaultHeight := false,         cancel_ctl:setAnchors([control::right, control::bottom]),         help_ctl := button::new(This),         help_ctl:setText("&Help"),         help_ctl:setPosition(176, 98),         help_ctl:setSize(56, 16),         help_ctl:defaultHeight := false,         help_ctl:setAnchors([control::right, control::bottom]). % end of automatic code   end implement color_dialog

Re: How to change background color of a standard Dialog without making custom control Dialog

Posted: 1 Dec 2021 4:12
by Harrison Pratt
Are you using ViP 10?

I don't think changing dialog backgrounds in Vip 9 or earlier can be done easily.

Re: How to change background color of a standard Dialog without making custom control Dialog

Posted: 1 Dec 2021 8:48
by Thomas Linder Puls
Assuming that you are using a sufficiently new Vip, you should just write:

Code: Select all

clauses     new(Parent) :-         dialog::new(Parent),         generatedInitialize(),         setBackgroundColor(color_aqua).

Re: How to change background color of a standard Dialog without making custom control Dialog

Posted: 1 Dec 2021 15:05
by abdelrahman
Yes ,, I use VIP 10 CE
it worked well and also simple , i missed this in earlier version of VIP .
thank you very much

Re: How to change background color of a standard Dialog without making custom control Dialog

Posted: 2 Dec 2021 13:46
by abdelrahman
by the way ,
with such like simplicity in changing Dialog background in vip 10
is it possible or there is new Features in vip 10 ce to change
Button control Background color , foreground Text Color or button Shape to ovoid one???

Re: How to change background color of a standard Dialog without making custom control Dialog

Posted: 2 Dec 2021 14:27
by Thomas Linder Puls
No, I am afraid not. A button (i.e. a Windows common controls button) does not support this in any simple way, you will have to create an "owner draw" button (which implies handling a lot of events and doing all the drawing yourself).