Transparent forms

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Transparent forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by Torrie Moore >> Wed, 14 Jun 2000 5:54:42 GMT

I'm trying to make a form transparent to get away from the boz shaped form. I can make the form transparent using the win api but sometimes Jade ignores this and paints the background colour of the form. I have seen some apps that have rounded courners etc. Can anyone tell me how to make the form transparent?

Thanks

Torrie Moore

Torrie@concept-eng.co.nz

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Transparent forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by Stephen Persson >> Wed, 14 Jun 2000 20:59:30 GMT

I also have tried using the win api with little success but have found an activeX which does the trick nicely letting you create custom form shapes with transparent regions.
Its very simply to use - just put a background image on your form and tell it what colour to make transparent.

Let me know if you're interested

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Transparent forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by Robert Barr >> Wed, 14 Jun 2000 22:44:15 GMT

Transparent form backgrounds is a big feature in the new MAC user interface. I expect it would be a great aid to the user when dealing
with multiple cascading forms, or a modal dialog overlaying a complex form, as it provides a additional visual context information (which
table row had I selected, was I in column 3 or column 4, etc). Of course the foreground form has to be well designed, or you end up with a mess.

I raised this as a JADE nfs when the MAC interface was announced, but no word yet. Let the plant know if you agree JADE support for this feature would be useful.

Robert Barr

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: JADE on the MAC?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by JADE Kid - Ray Hidayat >> Wed, 5 Jul 2000 21:46:28 GMT

JADE runs on the Mac? Gosh, that is a nice thing. Just as a point of interest, when you want to port a program from PC to Mac, do you have to Start from Scratch? Or can you just wave a magic wand and POOF! It is suddenly a Mac program?

--
Ray Hidayat
JADE Kid - 2000
www.jadekids.com

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: JADE on the MAC?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by Robert Barr >> Wed, 5 Jul 2000 23:35:18 GMT
JADE runs on the Mac? Gosh, that is a nice thing.

I meant the mac USER interface. Check out http://www.apple.com/macosx/technologies.html
Or can you just wave a magic wand and POOF! It is suddenly a Mac program?

Sure, sure. You just need to write the magic wand.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Transparent forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by Kevin Alcock >> Wed, 14 Jun 2000 23:09:46 GMT

Torrie,

try this:

button5_click(btn: Button input) updating;
constants
GWL_EXSTYLE = -20;
WS_EX_TRANSPARENT = #20;
HWND_NOTOPMOST = -2;

SWP_FRAMECHANGED = #20;
SWP_NOMOVE = #2;
SWP_NOSIZE = #1;

vars
swp_showme : Integer;begin


swp_showme := SWP_FRAMECHANGED.bitOr(SWP_NOMOVE.bitOr(SWP_NOSIZE));

call setWindowLong(hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT);
call setWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, swp_showme);
end;

External Functions:

setWindowLong(hWnd , nIndex, dwNewLong : Integer) : Integer is SetWindowLongA
in user32;

setWindowPos(hwnd, hWndInsertAfter , x, y , cx , cy , wFlags : Integer) : Integer is SetWindowPos in user32;



Have fun,

Kevin

--
kalcock@cardinal.co.nz
Cardinal Consultants
Phone: +64 3 365 2266 x 3086
Cell: +64 21 638 586

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Transparent forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by Torrie Moore >> Thu, 15 Jun 2000 0:57:46 GMT

Thanks for the code Kevin. You code was similar to mine but there is still a problem when Jade redraws the form. If you cover the window with another and then remove it Jade still paints the form with its background colour. I can't prevent this even by using a transparent picture control, with a transparent colour set for the picture background colour.

Torrie

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Paint Event!

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by JADE Kid - Ray Hidayat >> Wed, 5 Jul 2000 21:44:38 GMT

Try the paint event! Maybe it will work...

--
Ray Hidayat
JADE Kid - 2000
www.jadekids.com

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Transparent forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by Eric Peachey >> Thu, 15 Jun 2000 2:32:02 GMT

Hello Torrie,

Can't help you with the transparent stuff but if you just want rounded corners then you can try the code fragments below. Somebody else gave us the code so can't provide more help.


Eric in Dunedin



SomeForm::someMethod();
vars
rgn : Integer;begin

rgn := call createRoundRectRgn(scaleLeft.Integer +3, scaleTop.Integer +1, scaleWidth.Integer, scaleHeight.Integer, 85, 85);
call setWindRgn(hwnd, rgn, 2);
end;



where createRoundRectRgn is:

createRoundRectRgn(x1, y1, x2, y2, x3, y3 : Integer) : Integer is CreateRoundRectRgn in gdi32;


and setWindRgn is:

setWindRgn(hwnd, hRgn, bRedraw : Integer) : Integer is SetWindowRgn in user32;

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Transparent forms

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:25 pm

by Jens Richnow >> Thu, 15 Jun 2000 21:50:01 GMT

Hi,

you can use any API call which draw regions in conjunction with the setWindRgn (see Eric Peachy) for creating odd-shaped forms of any form, e.g. if you use the createPolygonRgn, createEllipticRgb, createPolyPolygonRgn of the GDI32. In all these cases the structures can be handled as binaries and all points passed into them as binaries as well.

The only draw back at the moment is, that it does not work in thin
client mode, a problem which is addressed by JADE Support.

Using API windows calls has the advantage that you don't have to distribute the ActiveX controls for each thin client installation...

Hope it helps

Jens


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 28 guests