# Transparency and Shaped Windows

> Source: https://manual.pvxplus.com/graphics/trans-shaped

PxPlus provides a number of features that allow you to enhance the appearance of your application and allow you to create widget-like applications with a minimum of effort.

## Frame/Border Control

Every window in the system can have a variety of borders around it. Dialogues and windows with a title usually have a caption line and thick border, windows with an 'empty' title has thin borders, and windows with no title have no border.

The ['OPTION'( )](https://manual.pvxplus.com/mnemonics/option#frame) mnemonic in PxPlus has a "FRAME" option that allows you to change the style of border on the fly for any window.

The valid options are:

|  |  |  |
| --- | --- | --- |
|  | **"NONE"** | The window has no border/frame. |
|  | **"CAPTION"** | The window has a border and caption line. |
|  | **"THICK"** | The window has a thick border. |
|  | **"THIN"** | The window has a thin border (usually a single pixel wide black line). |

## Window Transparency

There are two types of transparency supported within PxPlus:

|  |  |
| --- | --- |
| **Full Window Transparency** | Provides the ability for a window within the system to have see-through characteristics. That is, the user will be able to see the windows behind the current window.  <br>  <br>This feature is controlled by the PxPlus **'OPTION' mnemonic "[TRANSPARENCY](https://manual.pvxplus.com/mnemonics/option#transparency)"** option. This option allows the application to change the transparency of a window from "0" (non-transparent – normal window) to "100" (fully transparent invisible window). |
| **Transparent Masking** | Provides the ability to set a colour that is used to define a transparency mask. Wherever that colour occurs in the window will be transparent and allow access to the window/screen below.  <br>  <br>The **'OPTION' mnemonic** with the **"[MASKCOLOUR](https://manual.pvxplus.com/mnemonics/option#mask)"** option is used to define the colour to be used. If the colour is set as DEFAULT, the normal window background colour is used. |

## Creating a Shaped Window

These PxPlus features provide an easy way to create windows of different shapes. Let us create a "Happy Face" window for our application.

|  |  |
| --- | --- |
| **Step 1:** | Create the window to receive the "Happy Face".<br>First, we need to create a window that we want to use. We do not want the main window because of all the menu_bar and background; therefore, we will hide it and create a Dialogue window.<br>```<br>0010 ! Create the Window<br>0020 PRINT 'SHOW'(-1),'4D',<br>0030 PRINT 'DIALOGUE'(5,5,20,10,"Smiley",'_GREEN',OPT="c"),'SHOW'(-1),<br>0040 PRINT 'SR','CS',<br>```<br>![](https://manual.pvxplus.com/migration-assets/c1c22cb11a625875711abb0a028ad6e490f1152115d02c0b2cc268d90661ef38.png)<br>Notice that we created the window with a "GREEN" background, you'll see why later. We are also hiding the newly created Dialogue window to avoid the user seeing the logic as it draws. |
| **Step 2:** | Draw the "Happy Face".<br>```<br>0050 ! Draw a Happy face<br>0060 PRINT 'PEN'(1,2,0),'FILL'(1,3),'CIRCLE'(@X(10),@Y(5),@Y(4.5)),<br>0070 PRINT 'FILL'(1,0),<br>0080 PRINT 'CIRCLE'(@X(6),@Y(3),@X(1)),'CIRCLE'(@X(14),@Y(3),@X(1)),<br>0090 PRINT 'ARC'(@X(10),@Y(5),@Y(3),0,210,330),<br>0100 ! Give him a button nose<br>0110 BUTTON 4,@(7,4,6,1.5)="&Done"<br>```<br>![](https://manual.pvxplus.com/migration-assets/28eeaf5e9bdf4e3fa6e9980238a9ea445c2818d85037fd1c22834443255cf16a.jpg) |
| **Step 3:** | Remove the window frame.<br>```<br>0120 ! Remove the frame<br>0130 PRINT 'OPTION'("FRAME","NONE"),<br>```<br>![](https://manual.pvxplus.com/migration-assets/a564c806f92e9b23c9cd77ce9e27bd947c835fda5a996781abe2d4d8c1ec98e0.png) |
| **Step 4:** | Remove the background colour.<br>```<br>0140 ! Remove the background colour<br>0150 PRINT 'OPTION'("MASKCOLOR","DEFAULT"),<br>```<br>![](https://manual.pvxplus.com/migration-assets/195c276b22d8daa27e091d424b1516245c5a52a706f347178471712814153534.png)<br>This is why we created the window with a background colour. Choose a colour that will not occur within the actually window that you want preserved. |
| **Step 5:** | Show the completed window and wait for the button to be pressed.<br>```<br>0160 ! Now show the window<br>0170 PRINT 'SHOW'(3),<br>0180 ! Wait for button<br>0190 WHILE 1<br>0200 OBTAIN (0)'C0',*<br>0210 IF CTL=4 THEN BREAK<br>0220 WEND<br>``` |
| **Complete program below:** |  |
|  | \|  \|<br>\| --- \|<br>\| ```<br>0010 ! Create the Window<br>0020 PRINT 'SHOW'(-1),'4D',<br>0030 PRINT 'DIALOGUE'(5,5,20,10,"Smiley",'_GREEN',OPT="c"),'SHOW'(-1),<br>0040 PRINT 'SR','CS',<br>0050 ! Draw a Happy face<br>0060 PRINT 'PEN'(1,2,0),'FILL'(1,3),'CIRCLE'(@X(10),@Y(5),@Y(4.5)),<br>0070 PRINT 'FILL'(1,0),<br>0080 PRINT 'CIRCLE'(@X(6),@Y(3),@X(1)),'CIRCLE'(@X(14),@Y(3),@X(1)),<br>0090 PRINT 'ARC'(@X(10),@Y(5),@Y(3),0,210,330),<br>0100 ! Give him a button nose<br>0110 BUTTON 4,@(7,4,6,1.5)="&Done"<br>0120 ! Remove the frame<br>0130 PRINT 'OPTION'("FRAME","NONE"),<br>0140 ! Remove the background colour<br>0150 PRINT 'OPTION'("MASKCOLOR","DEFAULT"),<br>0160 ! Now show the window<br>0170 PRINT 'SHOW'(3),<br>0180 ! Wait for button<br>0190 WHILE 1<br>0200 OBTAIN (0)'C0',*<br>0210 IF CTL=4 THEN BREAK<br>0220 WEND<br>``` \| |
