More Visual Prolog 7.3 Examples

 

System Colors Handling

Written by Jose A. Becerril

 

 

The example:

  • Creates a standard Visual Prolog Task window with three buttons and two menu items.
  • The menu items produce a window and a dialogue with a colored background.
  • Two buttons change a part or all the colors in the Windows system.
  • The third button restores all colors to their original state.
  • A "safety device" restores colors if you close the application. (In any case, the changes are only permanent until log off or reboot).

What you can experiment: (in colores.pro)

  • Call Windows APIs using : 
resolve
     getSysColor    externally ,
     setSysColors   externally
  • Check the way I use an API, which originally points to two arrays:
showColour([H|T]):-
        H=pair(Item,Colour),
        Punto = memory::allocHeap(sizeOfDomain(binary)),
        BI = uncheckedConvert(binary, Punto),
        binary::setIndexed_integer32(BI, 0,Item),
         Value= uncheckedConvert( core::integer32, BI ),
   % ......................................................................................
  Punto2 = memory::allocHeap(sizeOfDomain(binary)),
                BI2 = uncheckedConvert(binary, Punto2),
  binary::setIndexed_integer32(BI2, 0,Colour),
  Value2 = uncheckedConvert( core::integer32, BI2 ),
                   setSysColors(1,Value,Value2)=TOK,
     TOK<>0,
      showColour(T),!.
  • See how to call a window or a dialog changing a background color (in NewWindows pinkWindow.pro)
clauses
        onUpdate(Rectangle) = defaultHandling():-
        vpi::winClear( thisWin,Rectangle,0xFF80FF),!.
  • See how to get the original color values and store them in a dba  to recover them later. (in store.pro).
storing_Colour: colores::pairList:=[].

 

Download the project

 

Note

The example requires Visual Prolog 7.3 Commercial Edition.

 

If you use the Personal Edition, but need the  features supported only in the Commercial Edition, you are welcome to order the latest build of this Edition just now: Order!

 

Users of previous versions of Visual Prolog are welcome to upgrade to the current version of Visual Prolog  to use the latest versions of the Visual Prolog examples.

 


Download VIP-ALC'08
Proceedings

Visual Prolog Application & Language Conference (VIP-ALC 2006) April 24-26 2006

Download VIP-ALC'06 Proceedings