Hello
partially works
But I would have to put an extra control
it would be interesting something in the GET for example.
Here's the tip for the next Fivewin updates
Mark field as required
-
- Posts: 51
- Joined: Tue Mar 23, 2010 12:53 pm
- Contact:
Re: Mark field as required
Márcio, great idea. In this case, only Mister Nages can do it. Let's wait for Master Nages' opinion.INFORMAISVRB wrote:Hello
partially works
But I would have to put an extra control
it would be interesting something in the GET for example.
Here's the tip for the next Fivewin updates
Sds.
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- Marc Venken
- Posts: 1481
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: Mark field as required
Look at this sample from Karinha, here you can put any bitmap into the get.
Code: Select all | Expand
// \SAMPLES\ARTIAGA.PRG - 14/02/2022
#include "fivewin.ch"
function main()
local oWnd
local oMenu
menu oMenu
MenuItem "From Code" action FromCode( oWnd )
// MenuItem "From Resource" action FromrES( oWnd )
endmenu
define window oWnd title "Test GET with <F2>" menu oMenu pixel
activate window oWnd MAXIMIZED
return oWnd
Function FromCode( oWnd )
local oDlg
local oGet1, oGet2, oGet3, oGet4
local cVar1, cVar2, cVar3, cVar4
local lActive := .f.
cVar1 := 0
cVar2 := 0
cVar3 := 0
cVar4 := 0
define dialog oDlg title "Test GET with <F2>" pixel size 300,300
oDlg:lHelpIcon := .F.
@ 10,10 get oGet1 var cVar1 bitmap "..\bitmaps\on.bmp" ;
action( TESTE_GET1() ) of oDlg pixel size 60,12
oGet1:cToolTip := OemToAnsi( "<F2> - ACTION con F2 GET 1" )
oGet1:lBtnTransparent := .T. // transparent button
// AQUI:
oGet1:bKeyDown := { |nKey| IF( nKey == VK_F2, Eval( oGet1:bAction ), Nil ) }
oGet1:lAdjustBtn := .t. // Button Get Adjust Witdh oGet3
oGet1:lDisColors := .f. // Deactive disable color
oGet1:nClrTextDis := CLR_WHITE // Color text disable status
oGet1:nClrPaneDis := CLR_BLUE // Color Pane disable status
@ 40,10 get oGet2 var cVar2 bitmap "..\bitmaps\on.bmp" ;
action( TESTE_GET2() ) of oDlg pixel size 60,12
oGet2:cToolTip := OemToAnsi( "<F2> - ACTION con F2 GET 2" )
oGet2:lBtnTransparent := .T. // transparent button
// AQUI:
oGet2:bKeyDown := { |nKey| IF( nKey == VK_F2, Eval( oGet2:bAction ), Nil ) }
oGet2:lAdjustBtn := .t. // Button Get Adjust Witdh oGet3
oGet2:lDisColors := .f. // Deactive disable color
oGet2:nClrTextDis := CLR_WHITE // Color text disable status
oGet2:nClrPaneDis := CLR_BLUE // Color Pane disable status
@ 70,10 get oGet3 var cVar3 bitmap "..\bitmaps\chkyes.bmp" ;
action( TESTE_GET3() ) of oDlg pixel size 120,12
oGet3:cToolTip := OemToAnsi( "<F2> - ACTION con F2 GET 3" )
oGet3:lBtnTransparent := .T. // transparent button
// AQUI:
oGet3:bKeyDown := { |nKey| IF( nKey == VK_F2, Eval( oGet3:bAction ), Nil ) }
oGet3:lAdjustBtn := .t. // Button Get Adjust Witdh oGet3
oGet3:lDisColors := .f. // Deactive disable color
oGet3:nClrTextDis := CLR_WHITE // Color text disable status
oGet3:nClrPaneDis := CLR_BLUE // Color Pane disable status
@ 100,10 get oGet4 var cVar4 bitmap "..\bitmaps\chkyes.bmp" ;
action( if( lActive,oGet3:disable(),oGet3:enable()), lActive:= !lActive, oDlg:update() ) of oDlg pixel size 120,12
oGet4:lAdjustBtn := .t.
activate dialog oDlg centered
return nil
FUNCTION TESTE_GET1()
? "ACTION con tecla <F2> en GET1"
RETURN NIL
FUNCTION TESTE_GET2()
? "ACTION con tecla <F2> en GET2"
RETURN NIL
FUNCTION TESTE_GET3()
? "ACTION con tecla <F2> en GET3"
RETURN NIL
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
Re: Mark field as required
New Version by Ricardo Marques.
Download Complete:
https://mega.nz/file/lVVRFDqS#bBZ63vcBU ... aL5wPcw0ls
Regards, saludos.
Download Complete:
https://mega.nz/file/lVVRFDqS#bBZ63vcBU ... aL5wPcw0ls
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Mark field as required
Alan Cooper in his book "About Face 2.0, The Essentials of Human Interaction Design" he makes the point that there shouldn't be any required fields.
When you think about it, this makes a lot of sense. Before computers, on a paper form, if there was any missing data, it was just left blank by the user. On a computer when we force them to enter something when they don't have that information, then they just put in anything so they can save the record. Or, they just select the Cancel button and thus all the other data is lost too.
Quote from "About Face":
Also, any data that appears to be in the wrong format, I color the field yellow. Thus in a phone field the user can type something like "ask Fred" instead of just leaving it blank. When a phone number is entered, the field turns white.
Records that have missing or questionable data are pink or yellow. Then in a browse, these records are flagged (with a flag icon) and thus can be easily found and dealt with if needed.
Yes it is complicated to code for all this, but if it was easy, then anyone could do it!
When you think about it, this makes a lot of sense. Before computers, on a paper form, if there was any missing data, it was just left blank by the user. On a computer when we force them to enter something when they don't have that information, then they just put in anything so they can save the record. Or, they just select the Cancel button and thus all the other data is lost too.
Quote from "About Face":
My first idea was to just color "required" fields pink. These fields then turn white after data is entered.This means that the software should keep track of who, what, where, how, and when the user is doing things, so that situation can be modified, rectified, or just plain understood at some later date. This is much more human than merely forcing the data into some arbitrary format whose correctness is judged mostly on its compliance to a file schema rather than to a human need.
Also, any data that appears to be in the wrong format, I color the field yellow. Thus in a phone field the user can type something like "ask Fred" instead of just leaving it blank. When a phone number is entered, the field turns white.
Records that have missing or questionable data are pink or yellow. Then in a browse, these records are flagged (with a flag icon) and thus can be easily found and dealt with if needed.
Yes it is complicated to code for all this, but if it was easy, then anyone could do it!
Last edited by James Bott on Tue Jul 25, 2023 11:48 pm, edited 1 time in total.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Re: Mark field as required
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Mark field as required
There is a serious issue when making fields required. If the user doesn't have that information, they will likely just put anything in the field so they can save the record.
An alternative is to allow the user to save the record even if some of the "required" data is unknown. You could then flag all the records missing the required data in a browse.
I color the backgrounds of "required" information in the dialog and flag the records missing "required" data with an icon of the same color in a browse. You could also filter a browse to contain only those records with missing "required" data. This allows the user (or any other user) to find the missing data at a later time and update the record.
An alternative is to allow the user to save the record even if some of the "required" data is unknown. You could then flag all the records missing the required data in a browse.
I color the backgrounds of "required" information in the dialog and flag the records missing "required" data with an icon of the same color in a browse. You could also filter a browse to contain only those records with missing "required" data. This allows the user (or any other user) to find the missing data at a later time and update the record.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Re: Mark field as required
You can do this:
@ 0,0 SAY "Test *" of oDlg//Monospaced font
@ 0, 6 GET of oDlg
oDlg:aControls[1]:SayText() //color the "*" symbol red
it works well, but it may need to be updated :SayText when moving the window off/on the screen
@ 0,0 SAY "Test *" of oDlg//Monospaced font
@ 0, 6 GET of oDlg
oDlg:aControls[1]:SayText() //color the "*" symbol red
it works well, but it may need to be updated :SayText when moving the window off/on the screen
Re: Mark field as required
Hello,
In my case I had to modify the TGet class to achieve the desired effect. What effect? Well, some Gets were mandatory for the user to fill in and so those Gets are marked with a little triangle indicating their obligation when they are empty. It is true that this system is not valid for radio button or check button.
The changes to the TGet class consist of adding a new data bMandatory that returns .t. If the Get is mandatory and a call to a new method, in the ::Paint() method draw a triangle in the lower left corner of the TGet()
Regards
In my case I had to modify the TGet class to achieve the desired effect. What effect? Well, some Gets were mandatory for the user to fill in and so those Gets are marked with a little triangle indicating their obligation when they are empty. It is true that this system is not valid for radio button or check button.
The changes to the TGet class consist of adding a new data bMandatory that returns .t. If the Get is mandatory and a call to a new method, in the ::Paint() method draw a triangle in the lower left corner of the TGet()
Code: Select all | Expand
// -------- DRAW TRIANGLE --------------------------------
STATIC FUNCTION TriangleDraw( oGet, hDC, nLONG, nHIGHT, nPEN, nCOLOR )
LOCAL hPen, hOldPen
Local nLeft:= 0
#Define CHAPUCITO_ 2 // para cuando el pen es de tamaño de mas de 2
Local nBottom:= oGet:nHeight- 1 + CHAPUCITO_
Local nLon:= 10 // Resolution dependency missing
Local nAlto:= nLon,;
nAncho:= nLon
#Define SEP_ 0 //If(!lFlatEstilo(), 0, 2)
Local nLeftIni:= nLeft+ SEP_+ 1 ,;
nBottomIni:= nBottom- SEP_- 3
/*
(2)
| \
| \(5)
| \(4)
| \
| \
|______\
(1) (3)
*/
Local hPen1, hBrus1, hOldBrush,;
vSolid
Local nColorNuevo:= CLR_BLUE
vsolid:= {;
{nLeftIni, nBottomIni },;
{nLeftIni, nBottomIni- nAlto },;
{nLeftIni+ nAncho, nBottomIni} ;
}
IF .t. //lFlatEstilo()
nColorNuevo:= LightColor(50, CLR_RED)
ENDIF
hPen1 := CreatePen( 0 , 1, nColorNuevo )
hBrush1 := CreateSolidBrush( nColorNuevo )
*
hOldBrush := SelectObject( hDC, hBrush1 )
hOldPen := SelectObject( hDC, hPen1 )
polypolygon( hDC, vsolid )
DeleteObject(hBrush1)
DeleteObject(hPen1)
RETURN NIL