Page 1 of 2

Get with "flat" border

Posted: Wed Nov 28, 2007 8:20 pm
by Maurilio Viana
Hi!

How can I create a get with flat style border? Using FW 16 bits was only set 3D look to false, but with FWH the get border don't get "flat" style...
I tryend oGet:l3Dlook := .F.

regards
Maurilio

Posted: Wed Nov 28, 2007 9:46 pm
by Antonio Linares
Maurilio,

Will it be ok just to remove its border or you want to remove the 3D effect in the border ?

Posted: Wed Nov 28, 2007 11:48 pm
by James Bott
Maurilio,

If you use the theme manifest you get the flat look.

James

Posted: Thu Nov 29, 2007 10:11 am
by Maurilio Viana
Antonio, I want to remove 3D effect (to 'get' assume single border).

Regards,
Maurilio

Posted: Thu Nov 29, 2007 1:33 pm
by nageswaragunupudi
Using NOBORDER clause while defining Get displays the Get FLAT without any border. ( Whether using Themes or not )

If NOBORDER is NOT used, if the application is Themed Get is displayed with single line border and if the application is Not Themed Get is displayed in 3D box style.

Posted: Thu Nov 29, 2007 3:35 pm
by Maurilio Viana
In Delphi I use Ctl3D property to False and cause the effect of this image:

Image

Antonio, any idea to quit 3D effect?

Regards
Maurilio

Posted: Fri Nov 30, 2007 1:33 am
by ShumingWang
A 'Easy dialog ' sample from Easy report site http://www.reportdesigner.info shows thes tget no 3D but with border clause.
Some other software 'GET' only with underline .
Someone who knows this?
Thanks !
Shuming Wang

Posted: Fri Nov 30, 2007 4:47 pm
by Antonio Linares
Maurilio,

This is a working solution. Maybe there is a simpler code for it, but we haven't found it yet. The advantage of this system is that you can choose the border color and thickness:

Code: Select all

#include "FiveWin.ch"

function Main()

   local oDlg, oGet, cTest := Space( 20 )

   DEFINE DIALOG oDlg 

   @ 2, 2 GET oGet VAR cTest SIZE 80, 10 NOBORDER

   oGet:bPainted = { || PaintBorder( oGet, oDlg ) }

   ACTIVATE DIALOG oDlg CENTERED

return nil

function PaintBorder( oGet, oDlg )

   local aPoint1 := { -1, -1 }
   local aPoint2 := { oGet:nHeight, oGet:nWidth }
   
   aPoint1 = ClientToScreen( oGet:hWnd, aPoint1 )
   aPoint1 = ScreenToClient( oDlg:hWnd, aPoint1 )
   aPoint2 = ClientToScreen( oGet:hWnd, aPoint2 )
   aPoint2 = ScreenToClient( oDlg:hWnd, aPoint2 )
   
   WndBox( oDlg:GetDC(), aPoint1[ 1 ], aPoint1[ 2 ], aPoint2[ 1 ], aPoint2[ 2 ] )
   oDlg:ReleaseDC()
   
return nil
Image

Posted: Fri Nov 30, 2007 6:55 pm
by Maurilio Viana
Thanks a lot, Antoio!!!
Where can I define border color?
I think paint blue or red obligatory fields to user get a visual reference.

Regards!
Maurilio

Posted: Fri Nov 30, 2007 7:53 pm
by Antonio Linares
Maurilio,

> Where can I define border color?

Please review the source code of WndBox() in source\function\wndboxes.c

You could easily implement your own border drawing function with the desired colors and thickness

Posted: Fri Nov 30, 2007 8:12 pm
by Maurilio Viana
Thanks a lot again, Antonio!

Regards
Maurilio

Posted: Fri Nov 30, 2007 11:31 pm
by James Bott
Maurilio,

>I think paint blue or red obligatory fields to user get a visual reference.

I show the background color of the GET as pink if the field is required and empty, and yellow if the field contains questionable data.

You may note that Microsoft has starting doing something simlar--the address field in IE is green when the site is safe.

James

Posted: Mon Dec 03, 2007 4:46 pm
by Maurilio Viana
Antonio,

I changed my TGet.prg Paint method to draw a rectangle before DispEnd() call. I created a pen with the color I want the border. And worked fine (I must try under Win 98).

But I want to do the same in combobox control. Do you have idea of a place to insert rectangle call to draw the "new" border of combobox?

Regards,
Maurilio

Posted: Mon Dec 03, 2007 4:53 pm
by Antonio Linares
Maurilio,

You have to implement Method Paint() in Class TComboBox and do similar as we do in Class TButtonBmp: (source\classes\buttonb.prg)

Code: Select all

METHOD Paint() CLASS TComboBox

   local aInfo := ::DispBegin()

   CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )

   If( ! Empty( ::bPainted ), Eval( ::bPainted, ::hDC ),)

   ::DispEnd()

return 1
Also you may need to add:

Code: Select all

   METHOD Display() INLINE ::BeginPaint(), ::Paint(), ::EndPaint(), 0

Posted: Mon Dec 03, 2007 5:11 pm
by James Bott
Maurilio,

Is there a reason you don't want to just use the themed look? This would give you the flat border on all controls and it is the way most programs are now.

James