Border around GET

Border around GET

Postby fraxzi » Fri May 14, 2010 12:03 am

Dear All,

How to make border around Get like this
Image


I need to put this on empty Get Object and remove if filled with value..


Regards,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Border around GET

Postby Silvio » Fri May 14, 2010 8:24 am

Image
on Paint method
BEFORE ::DispEnd( aInfo )

RoundRect(::hDc,0,0,::nWidth-1,::nHeight-1,9,9)

THEN TRY WITH XPLOOK.RC

DEFINE DIALOG oDlg SIZE 400,200 TITLE "I am a DialogBox"

@ 2, 3 GET oGet var cTest OF oDlg NOBORDER
@ 6, 3 GET oGet var cTest OF oDlg NOBORDER

ACTIVATE DIALOG oDlg CENTERED



BUT THIS IS ONLY AN small idea ....
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Border around GET

Postby fraxzi » Wed May 19, 2010 5:25 am

Silvio wrote:Image
on Paint method
BEFORE ::DispEnd( aInfo )

RoundRect(::hDc,0,0,::nWidth-1,::nHeight-1,9,9)

THEN TRY WITH XPLOOK.RC

DEFINE DIALOG oDlg SIZE 400,200 TITLE "I am a DialogBox"

@ 2, 3 GET oGet var cTest OF oDlg NOBORDER
@ 6, 3 GET oGet var cTest OF oDlg NOBORDER

ACTIVATE DIALOG oDlg CENTERED

BUT THIS IS ONLY AN small idea ....



Dear Silvio,

Thank you for the idea.. I really appreciate it..

I wish a method not to change class.. and border is much larger where I can revert to default (or remove it) when validation is ok.


Best regards,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Border around GET

Postby ukoenig » Wed May 19, 2010 12:03 pm

Maybe ( with any Color and Pen-Size ) ???

Image

REDEFINE GET oGET1 VAR cGET1 ID 250 OF oDlg UPDATE
// TOP, LEFT, hDC, WIDTH, HEIGHT, PEN, COLOR
oGet1:bPainted := { |hDC| DRAWBOX( 0, 0, hDC, oGet1:nWidth-5, oGet1:nHeight-5, 3, 128 ) }

// -------- DRAW Get-BOX --------------------------------' )

STATIC FUNCTION DRAWBOX( nTOP, nLEFT, hDC, nLONG, nHIGHT, nPEN, nCOLOR )
LOCAL hPen := CREATEPEN( PS_SOLID, nPEN, nColor )
LOCAL hOldPen := SELECTOBJECT( hDC, hPen )

MOVETO( hDC, nTOP, nLEFT )
LINETO( hDC, nLong, 0 )
LINETO( hDC, nLONG, nHIGHT )
LINETO( hDC, 0, nHIGHT )
LINETO( hDC, 0, 0 )
SELECTOBJECT( hDC, hOldPen )
DELETEOBJECT( hPen )

RETURN NIL

================================

To move a Box to the foused Get is very easy :
Instead of Focus, You can change the Logic using Valid

Image

Use a Startflag for the 1. focused Get :

nPos := 1

REDEFINE GET oGET1 VAR cGET1 ID 250 OF oDlg UPDATE
// TOP, LEFT, hDC, WIDTH, HEIGHT, PEN, COLOR
oGet1:bPainted := { |hDC| IIF( nPos = 1, ( DRAWBOX( 0, 0, hDC, oGet1:nWidth-5, oGet1:nHeight-5, 3, 128 ), ;
DRAWBOX( 0, 0, hDC, 0, 0, 0, 0) ), NIL) }
oGet1:bGotFocus := { |hDC| nPos := 1, oGet2:Refresh(), oGet3:Refresh() }

REDEFINE GET oGET2 VAR cGET2 ID 260 OF oDlg UPDATE
oGet2:bPainted := { |hDC| IIF( nPos = 2, ( DRAWBOX( 0, 0, hDC, oGet2:nWidth-5, oGet2:nHeight-5, 3, 128 ), ;
DRAWBOX( 0, 0, hDC, 0, 0, 0, 0) ), NIL) }
oGet2:bGotFocus := { |hDC| nPos := 2, oGet1:Refresh(), oGet3:Refresh() }

REDEFINE GET oGET3 VAR cGET3 ID 270 OF oDlg UPDATE
oGet3:bPainted := { |hDC| IIF( nPos = 3, ( DRAWBOX( 0, 0, hDC, oGet3:nWidth-5, oGet3:nHeight-5, 3, 128 ), ;
DRAWBOX( 0, 0, hDC, 0, 0, 0, 0) ), NIL) }
oGet3:bGotFocus := { |hDC| nPos := 3, oGet1:Refresh(), oGet2:Refresh() }

============================

Using a Valid for the 1. get ( using Values for all Gets ) :
Shows a Red Box for the 3. Get, if the Value of the 3. Get > 100

REDEFINE GET oGET1 VAR nGET1 ID 250 OF oDlg UPDATE ;
VALID ( IIF( nGET3 > 100, ( nPos := 3, oGet1:Refresh(), oGet2:Refresh(), oGet3:Refresh() ), NIL ), .T. )
// TOP, LEFT, hDC, WIDTH, HEIGHT, PEN, COLOR
oGet1:bPainted := { |hDC| IIF( nPos = 1, ( DRAWBOX( 0, 0, hDC, oGet1:nWidth-5, oGet1:nHeight-5, 3, 128 ), ;
DRAWBOX( 0, 0, hDC, 0, 0, 0, 0) ), NIL) }
oGet1:bGotFocus := { |hDC| nPos := 1, oGet2:Refresh(), oGet3:Refresh() }

The VALID- results :

Image

Image

Best Regards
Uwe :lol:
Last edited by ukoenig on Fri May 28, 2021 5:10 am, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Border around GET

Postby lailton.webmaster » Wed May 19, 2010 6:32 pm

lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Border around GET

Postby ukoenig » Wed May 19, 2010 7:52 pm

Maybe I don't understand the Question.
<around> means just a Frame to me, <Round> means a round Border ???
As well a Solution needed :

.... where I can revert to default (or remove it) when validation is ok.

Best Regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Border around GET

Postby lailton.webmaster » Wed May 19, 2010 8:05 pm

Sorry
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Border around GET

Postby lailton.webmaster » Wed May 19, 2010 8:10 pm

I think that this solve your problem

nVar:=0

define dialog oDlg ....

redefine Get oGet Var nVar .... ON CHANGE validate( nVar, 100, oDlg )



function validate( nVar, nMax, oDialog )

if (nVar > nMax )

DRAWBOX....
else
oDialog:Refresh()
endif

return
return
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Border around GET

Postby fraxzi » Thu May 20, 2010 12:48 am

Dear Guys,

Thank you Laiton!

Thank you Uwe.. Your a great help..

I will immediately adapt your idea.


My Best Regards,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Border around GET

Postby ukoenig » Thu May 20, 2010 9:32 pm

A complete Solution ( modified )
3 Tests You can activate / deactivate
All Types are supported : C, N, L, D

1. Show Box on Get-Focus
2. Show Box on empty Values on Init
3. Show Box with valid Values on Init

Image

Code: Select all  Expand view

#include "fivewin.ch"

FUNCTION MAIN()
Local oDlg, hDC
Local oGet1,oGet2,oGet3,oGet4
local cVar1 := "Test"
local nVar2 := 100
local lVar3 := .F.
local dVar4 := DATE()

local oSay1, oSay2, oSay3, oSay4
local cSay1 := "Test"

local  oGetFont := TFont():New("Arial", ,-14,.F.,.T. , , , ,.T. )

SET DATE GERMAN
SET CENTURY ON

DEFINE DIALOG oDlg from 0,0 to 300, 300 pixel TITLE "Testing Boxes on GET"

@ 15, 50 get oGet1 var cVar1 picture "@!" size 50, 15 of oDlg pixel FONT oGetFont
// on Lostfocus delete Box
// -------------------------------
oGet1:bLostFocus := {|hDC| GETBOX( oGet1, hDC, NIL, NIL, NIL, NIL, .F. ) }

@ 40, 50 get oGet2 var nVar2 picture "99999" size 50,15 of oDlg pixel  FONT oGetFont
oGet2:bLostFocus := {|hDC| GETBOX( oGet2, hDC, NIL, NIL, NIL, NIL, .F. ) }

@ 65, 50 get oGet3 var lVar3 size 50,15 of oDlg pixel  FONT oGetFont
oGet3:bLostFocus := {|hDC| GETBOX( oGet3, hDC, NIL, NIL, NIL, NIL, .F. ) }

@ 90, 50 get oGet4 var dVar4 PICTURE "##.##.####" size 50,15 of oDlg pixel  FONT oGetFont
oGet4:bLostFocus := {|hDC| GETBOX( oGet4, hDC, NIL, NIL, NIL, NIL, .F. ) }


// GETBOX( oGet, hDC, Getvar, Getcond, lValid, lEmpty, lStatus )
// ----------------------------------------------------------------------------------
// oGet
// hDC
// Getvar = Value
// Getcond = Valid Value
// lValid = Valid .T. or .F.
// lEmpty = Empty .T. or .F.
// lStatus = Show Box .T. or .F.

// Show Box on Get-Focus
// GETBOX( oGet, hDC, Getvar, Getcond, lValid, lEmpty, lStatus )
// ----------------------------------------------------------------------------------
oGet1:bGotFocus := {|hDC| GETBOX( oGet1, hDC, cVar1, "", .F., .F., .T. ) }
oGet2:bGotFocus := {|hDC| GETBOX( oGet2, hDC, nVar2, 0, .F., .F., .T. ) }
oGet3:bGotFocus := {|hDC| GETBOX( oGet3, hDC, lVar3, .F., .F., .F., .T. ) }
oGet4:bGotFocus := {|hDC| GETBOX( oGet4, hDC, dVar4, DATE(), .F., .F., .T. ) }


// Draw Box for for all  empty Values
// GETBOX( oGet, hDC, Getvar, Getcond, lValid, lEmpty, lStatus )
// ----------------------------------------------------------------------------------
*GETBOX( oGet1, hDC, cVar1, "", .F., .T., .T. )
*GETBOX( oGet2, hDC, nVar2, 0, .F., .T., .T. )
*GETBOX( oGet3, hDC, lVar3, .F., .F., .T., .T. )
*GETBOX( oGet4, hDC, dVar4, CTOD("  .  .    "), .F., .T. )


// Init Box with Valid-Test
// GETBOX( oGet, hDC, Getvar, Getcond, lValid, lEmpty, lStatus )
// -----------------------------------------------------------------------------------
*GETBOX( oGet1, hDC, cVar1, "Test", .T., .F., .T. )  // NO Box
*GETBOX( oGet2, hDC, nVar2, 200, .T., .F., .T. )  // SHOW Box
*GETBOX( oGet3, hDC, lVar3, .T., .T., .F., .T. ) // SHOW Box
*GETBOX( oGet4, hDC, dVar4, DATE(), .T., .F., .T. ) // NO Box


@ 7, 9 BUTTON "&Cancel" ACTION oDlg:End() CANCEL

ACTIVATE DIALOG oDlg CENTERED
 
RETURN NIL

// --------- GET with Box --------------------------

FUNCTION GETBOX( oGet, hDC, Getvar, Getcond, lValid, lEmpty, lStatus )

IF lStatus = .T.
   IF ( lEmpty = .T. .and. EMPTY(Getvar) ) .or. ;
       ( lValid = .F. .and. lEmpty = .F. )  // Empty or Focus
      // TOP, LEFT, hDC, WIDTH, HEIGHT, PEN, COLOR
      oGet:bPainted := { |hDC| DRAWBOX( 0, 0, hDC, ;
      oGet:nWidth-5, oGet:nHeight-5, 5, 128 ) }
   ENDIF
   IF VALTYPE ( Getvar ) = "C"
      // defined Valid
      IF lValid = .T. .and. Getvar <> Getcond  
         oGet:bPainted := { |hDC| DRAWBOX( 0, 0, hDC, ;
         oGet:nWidth-5, oGet:nHeight-5, 5, 128 ) }
      ENDIF
   ELSEIF VALTYPE ( Getvar ) = "N"
      IF  lValid = .T. .and. Getvar < Getcond
         oGet:bPainted := { |hDC| DRAWBOX( 0, 0, hDC, ;
         oGet:nWidth-5, oGet:nHeight-5, 5, 128 ) }
      ENDIF
   ELSEIF VALTYPE ( Getvar ) = "L"
      IF lValid = .T. .and. Getvar <> Getcond
         oGet:bPainted := { |hDC| DRAWBOX( 0, 0, hDC, ;
         oGet:nWidth-5, oGet:nHeight-5, 5, 128 ) }
      ENDIF
   ELSEIF VALTYPE ( Getvar ) = "D"
      IF lValid = .T. .and. Getvar <> Getcond
         oGet:bPainted := { |hDC| DRAWBOX( 0, 0, hDC, ;
         oGet:nWidth-5, oGet:nHeight-5, 5, 128 ) }
      ENDIF
   ENDIF
ELSE
   oGet:bPainted := { |hDC| DRAWBOX( 0, 0, hDC, 0, 0, 0, 0) }
ENDIF

RETURN NIL

// --------  DRAW BOX --------------------------------

STATIC FUNCTION DRAWBOX( nTOP, nLEFT, hDC, nLONG, nHIGHT, nPEN, nCOLOR )
LOCAL hPen := CREATEPEN( PS_SOLID, nPEN, nColor )
LOCAL hOldPen := SELECTOBJECT( hDC, hPen )

MOVETO( hDC, nTOP, nLEFT )
LINETO( hDC, nLong, 0 )
LINETO( hDC, nLONG, nHIGHT )
LINETO( hDC, 0, nHIGHT )
LINETO( hDC, 0, 0 )
SELECTOBJECT( hDC, hOldPen )
DELETEOBJECT( hPen )

RETURN NIL
 


Best Regards
Uwe :lol:
Last edited by ukoenig on Fri May 28, 2021 5:12 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Border around GET

Postby fraxzi » Thu May 20, 2010 11:25 pm

Dear Uwe,

Thank you so much for your kind and generous help.


Mabuhay!


Best Regards,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Border around GET

Postby ukoenig » Sun May 30, 2010 2:49 pm

I tested still another Solution from Source
painting a BMP behind ( SAY and GET ) :

Image

A Gradient-Solution :
Image

Image

A special Border :
Image

Borders for SAY and GET calculated.
Say and Get must be placed before BMP :

@ 140,10 say oSay1 PROMPT "Row one" PIXEL FONT oGetFont
@ 138,5 BITMAP oBmp11 FILENAME "B_Blue2.bmp" ;
SIZE oSay1:nWidth + 10, oSay1:nHeight + 7 OF oDlg PIXEL ADJUST NOBORDER

@ 140, 100 GET oGet1 VAR cVar1 picture "@!" SIZE 50, 15 OF oDlg PIXEL FONT oGetFont
@ 138,95 BITMAP oBmp10 FILENAME "B_Red2.bmp" ;
SIZE oGet1:nWidth + 10, oGet1:nHeight + 7 OF oDlg PIXEL ADJUST NOBORDER

// Define the Border Start-Condition on Dialog-Init :

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oBmp10:Hide(), oBmp11:Hide() )

Hide / Show Border on Button-Action :

Code: Select all  Expand view

// SAY with any Background-Bmp
@ 135,5 BITMAP oBmp11 FILENAME "B_Blue1.bmp" SIZE 68, 24 OF oDlg PIXEL ADJUST NOBORDER
@ 140,10 say oSay1 PROMPT "Row one" PIXEL FONT oGetFont

// GET with any Background-Bmp
@ 135,95 BITMAP oBmp10 FILENAME "B_Red1.bmp" SIZE 60, 25 OF oDlg PIXEL ADJUST NOBORDER
@ 140, 100 GET oGet1 VAR cVar1 picture "@!" SIZE 50, 15 OF oDlg PIXEL FONT oGetFont


@ 175, 175 BTNBMP oBtn3 OF oDlg 2007 ;
SIZE 60 , 30  PROMPT "Border ON" ;
FONT oGetFont ;
LEFT ;
NOBORDER ;
FILENAME "Tools.bmp" ;
ACTION (oBmp10:Show, oBmp11:Show )                                          
oBtn3:lTransparent := .T.
oBtn3:cTooltip := "  Desktop 1 "
oBtn3:lBorder := .F.

@ 210, 175 BTNBMP oBtn3 OF oDlg 2007 ;
SIZE 60 , 30  PROMPT "Border OFF" ;
FONT oGetFont ;
LEFT ;
NOBORDER ;
FILENAME "Tools.bmp" ;
ACTION ( oBmp10:Hide, oBmp11:Hide )                                          
oBtn3:lTransparent := .T.
oBtn3:cTooltip := "  Desktop 1 "
oBtn3:lBorder := .F.
 


Best Regards
Uwe :lol:
Last edited by ukoenig on Fri May 28, 2021 5:13 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Border around GET

Postby fraxzi » Fri Jan 07, 2011 1:05 am

Dear Uwe,

I tried with get multiline but it wont work.. How to do this with multiline get.. any idea?

Code: Select all  Expand view

STATIC FUNCTION uDrawBoxOnGet( nTop, nLeft, hDC, nLong, nHeight, nPen, nColor, oGet )
 LOCAL hPen,;
       hOldPen
 
 hPen := CreatePen( PS_SOLID, nPen, nColor )
 hOldPen := SelectObject( hDC, hPen )
 
 MoveTo( hDC, nTop, nLeft )
 
 TRY
   LineTo( hDC, nLong-IF(oGet:oBtn == Nil,0,22), 0 )
   LineTo( hDC, nLong-IF(oGet:oBtn == Nil,0,22), nHeight )
 CATCH
   LineTo( hDC, nLong, 0 )           //in-case the oGet:oBtn doesn't exist
   LineTo( hDC, nLong, nHeight )
 END
 
 LineTo( hDC, 0, nHeight )
 LineTo( hDC, 0, 0 )
 SelectObject( hDC, hOldPen )
 DeleteObject( hPen )
 
RETURN
 



Kind Regards,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Border around GET

Postby fraxzi » Thu May 12, 2011 2:40 am

Dear Mr. Uwe,

Any update on multiget border?


Kind Regards,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Border around GET

Postby ukoenig » Fri May 13, 2011 9:31 am

Hello Frances,

I tested, moving the Border to the Dialog ( not insided the Get ) in Relation to the Multiline-get-dimension.
It seems, it could be a Solution.

Image

STATIC PROCEDURE Draw_Box(oDlg, oGet, nColor)
// x, y , nHigh, nWidht

// Top
DrawLine( oDlg, oGet:nTop - 5, oGet:nLeft - 5 , oGet:nTop - 5, oGet:nWidth + 32, 5, nColor )
// Bottom
DrawLine( oDlg, 125, oGet:nLeft - 5 , 125, oGet:nWidth + 32, 5, nColor ) // 32 needed for Scrollbar
// Left
DrawLine( oDlg, oGet:nTop - 5, oGet:nTop - 5 , 125, oGet:nLeft - 5, 5, nColor ) // 125 = Multiget-height
// Right
DrawLine( oDlg, oGet:nTop - 5, oGet:nWidth + 32 , 125, oGet:nWidth + 32, 5, nColor )

RETURN

Best Regards
Uwe :?:
Last edited by ukoenig on Fri May 28, 2021 5:14 am, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 74 guests