Setfocus problem

Setfocus problem

Postby reds » Thu Apr 26, 2018 5:00 pm

On successful validation of the first GET I want to move to the second using SetFocus but it jumps to the Exit button instead.
(If I remove the second GET WHEN clause it will move to it but doesn't change to the gotfocus colours)

TIA
Peter


Code: Select all  Expand view  RUN

#include "FWCE.ch"
#include "vkey.ch"

STATIC oWnd,oFont[3]
STATIC oGetPass
***********************
FUNCTION Main()
 
  DEFINE FONT oFont[1] NAME "Ariel" SIZE 4,  12 BOLD
  DEFINE FONT oFont[2] NAME "Ariel" SIZE 12, 14 BOLD  
  DEFINE FONT oFont[3] NAME "Ariel" SIZE 16, 20 BOLD

  DEFINE WINDOW oWnd
   
   @ 4.75,5      BUTTON  oExit    PROMPT "Exit"      OF owND     SIZE 60, 30     FONT oFont[1] ACTION  {|| oWnd:END()}
   
  ACTIVATE WINDOW oWnd ON INIT UserLogin()

******************
FUNCTION UserLogin()

LOCAL oExit
LOCAL oDlg
LOCAL nEmploy := 0

PRIVATE lValidUser  := lValidPass := .f.
PRIVATE nTries := 0

PRIVATE oGetEmploy
PRIVATE cNewpass := SPACE(10)

DEFINE DIALOG oDlg OF oWnd TITLE "Login" FROM 3, 3 TO 16, 27.5

@ .25,4       Say "Employee" COLOR CLR_RED,CLR_WHITE SIZE 60,8  // FONT oFont[2]
@ 1.25,.5     GET oGetEmploy VAR nEmploy PICT "999999999999999" OF oDlg SIZE 90,16  UPDATE  ; //FONT oFont[2]
                                  VALID  {|| lValidUser :=  ValidUser(nEmploy,oDlg)}

oGetEmploy:bGotFocus    := { || oGetEmploy:SetColor(CLR_RED,CLR_GRAY)}
oGetEmploy:bLostFocus   := { || oGetEmploy:SetColor(CLR_HBLUE,CLR_WHITE)}

  @ 3.1,4        Say "Password"   COLOR CLR_RED,CLR_WHITE SIZE 60,8 //FONT oFont[2]
  @ 4.5,.5       GET oGetPass VAR cNewPass PICT "XXXXXXXXXX" OF oDlg SIZE 90,16  WHEN  lValidUser ; // FONT oFont[2]
                               VALID { || lvalidPass := ValidPass(cNewPass,oDlg) } UPDATE

oGetPass:bGotFocus    := { || oGetPass:SetColor(CLR_RED,CLR_GRAY)}
oGetPass:bLostFocus   := { || oGetPass:SetColor(CLR_HBLUE,CLR_WHITE)}

@ 4.75,5      BUTTON  oExit    PROMPT "Exit"      OF oDlg     SIZE 30, 10     ACTION  {|| oWnd:END()} //  FONT oFont[2]


ACTIVATE DIALOG oDlg   VALID lValidPass

******************************
FUNCTION ValidUser(nUser,oDlg)

IF GetAsyncKey( VK_LBUTTON ) .OR. GetAsyncKey( VK_LBUTTON )
   oWnd:End()
ENDIF

 DO case
     case nUser = 1
        RETURN .f.
     case nUser = 2
   
     
       //(oGetPass:SetFocus(),.t.)
      // oGetPass:Refresh()
     //oGetPass:bLostFocus   := { || oGetPass:SetColor(CLR_HBLUE,CLR_WHITE),SetFocus()}

     oGetpass:SetFocus()
 
       RETURN .t.
 ENDCASE
 
  RETURN .F.

*******************************
FUNCTION   ValidPass(cNewPass,oDlg)

IF GetAsyncKey( VK_LBUTTON ) .OR. GetAsyncKey( VK_LBUTTON )
   oWnd:End()
ENDIF

   IF EMPTY(TRIM(cNewPass))
      RETURN .F.
   ENDIF

    cDecrypt := "secret"

     IF  cDecrypt =  TRIM(cNewpass)  
         lValidpass := .t.      
         oDlg:End()
      ELSE  
          nTries++
          IF nTries >= 3            
             oWnd:END()
          ENDIF
          cNewpass := SPACE(10)
          odlg:update()
         RETURN .F.
     ENDIF
         
           
 RETURN .t.
         


 
reds
 
Posts: 50
Joined: Tue May 16, 2017 12:19 pm
Location: North London

Re: Setfocus problem

Postby Antonio Linares » Thu Apr 26, 2018 5:29 pm

Peter,

Please try with:

oGetEmploy:oJump := oGetPass
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Setfocus problem

Postby reds » Fri Apr 27, 2018 9:33 am

Thanks Antonio

That did the trick :)

Regards
Peter

p.s. Where can I get a copy of builddll.bat ?
reds
 
Posts: 50
Joined: Tue May 16, 2017 12:19 pm
Location: North London

Re: Setfocus problem

Postby Antonio Linares » Fri Apr 27, 2018 11:47 am

Peter,

We provide two batch files to create DLLs:

1. buildhd.bat for self contained DLLs (the Harbour virtual machine goes inside the DLL)

2. buildhdp.bat for pcode DLLs (the Harbour virtual machine goes inside the EXE that uses this DLL)

They should be at your samples folder
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Setfocus problem

Postby reds » Mon Apr 30, 2018 1:07 pm

Antonio

I've rerun FWPPC.EXE (mod 09/10/2016) and extracted all the files , the only build batch file is buildce

On another subject is the Freeze option available on Listbox /TwBrowse as I'm getting an error

TIA
Peter
reds
 
Posts: 50
Joined: Tue May 16, 2017 12:19 pm
Location: North London

Re: Setfocus problem

Postby Antonio Linares » Tue May 01, 2018 8:05 am

Peter,

buildhd.bat
Code: Select all  Expand view  RUN
@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for Harbour 18.03 - Mar. 2018            Harbour development power ³Ü
ECHO ³ (c) FiveTech, 1993-2018   for Microsoft Windows 9x/NT/2000/ME/XP/Vista/7/8 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

if "%FWDIR%" == "" set FWDIR=.\..
if "%HBDIR%" == "" set HBDIR=c:\harbour
rem if "%2" == "/b" set GT=gtwin
rem if not "%2" == "/b" set GT=gtgui
set GT=gtgui

ECHO Compiling...

set hdir=%HBDIR%
set hdirl=%hdir%\lib
set fwh=%FWDIR%
if exist c:\bcc7 set bcdir=c:\bcc7
if exist c:\bcc64 set bcdir=c:\bcc64

%hdir%\bin\harbour %1 /n /i..\include;%hdir%\include /w /p %2 %3 > clip.log 2> warnings.log
@type clip.log
@type warnings.log

IF ERRORLEVEL 1 PAUSE
IF ERRORLEVEL 1 GOTO EXIT

echo -O2 -I%hdir%\include %1.c > b32.bc
%bcdir%\bin\bcc32 -M -c @b32.bc
:ENDCOMPILE

IF EXIST %1.rc %bcdir%\bin\brc32 -r %1

echo c0d32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.dll, + >> b32.bc
echo %1.map, + >> b32.bc
echo ..\lib\FiveH.lib ..\lib\FiveHC.lib + >> b32.bc
echo %hdirl%\hbwin.lib + >> b32.bc
echo %hdirl%\gtgui.lib + >> b32.bc
echo %hdirl%\hbrtl.lib + >> b32.bc
echo %hdirl%\hbvm.lib + >> b32.bc
echo %hdirl%\hblang.lib + >> b32.bc
echo %hdirl%\hbmacro.lib + >> b32.bc
echo %hdirl%\hbrdd.lib + >> b32.bc
echo %hdirl%\rddntx.lib + >> b32.bc
echo %hdirl%\rddcdx.lib + >> b32.bc
echo %hdirl%\rddfpt.lib + >> b32.bc
echo %hdirl%\hbsix.lib + >> b32.bc
echo %hdirl%\hbdebug.lib + >> b32.bc
echo %hdirl%\hbcommon.lib + >> b32.bc
echo %hdirl%\hbpp.lib + >> b32.bc
echo %hdirl%\hbcpage.lib + >> b32.bc
echo %hdirl%\hbcplr.lib + >> b32.bc
echo %hdirl%\hbct.lib + >> b32.bc
echo %hdirl%\hbpcre.lib + >> b32.bc
echo %hdirl%\xhb.lib + >> b32.bc
echo %hdirl%\hbziparc.lib + >> b32.bc
echo %hdirl%\hbmzip.lib + >> b32.bc
echo %hdirl%\hbzlib.lib + >> b32.bc
echo %hdirl%\minizip.lib + >> b32.bc
echo %hdirl%\png.lib + >> b32.bc
echo %hdirl%\hbusrrdd.lib + >> b32.bc
echo %hdirl%\hbtip.lib + >> b32.bc

rem Uncomment these two lines to use Advantage RDD
rem echo %hdir%\lib\b32\rddads.lib + >> b32.bc
rem echo ..\lib\Ace32.lib + >> b32.bc

echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\uuid.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\ws2_32.lib + >> b32.bc
echo %bcdir%\lib\psdk\odbc32.lib + >> b32.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\iphlpapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\msimg32.lib + >> b32.bc
echo %bcdir%\lib\psdk\psapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\rasapi32.lib + >> b32.bc
echo %bcdir%\lib\psdk\gdiplus.lib + >> b32.bc
echo %bcdir%\lib\psdk\shell32.lib, >> b32.bc

IF EXIST %1.res echo %1.res >> b32.bc
%bcdir%\bin\ilink32 -Tpd @b32.bc

IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * self contained DLL successfully built
GOTO EXIT
ECHO

rem delete temporary files
@del %1.c
@del %1.il?

:LINKERROR
ECHO * There are errors
GOTO EXIT

:SINTAX
ECHO    SYNTAX: Build [Program]     {-- No especifiques la extensi¢n PRG
ECHO                                {-- Don't specify .PRG extension
GOTO EXIT

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT


buildhdp.bat
Code: Select all  Expand view  RUN
@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for Harbour 18.03 - Mar. 2018             Harbour development power ³Ü
ECHO ³ (c) FiveTech, 1993-2018    for Microsoft Windows 9x/NT/2000/ME/XP/Vista/7/8 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

ECHO Compiling...

set hdir=c:\harbour
set bcdir=c:\bcc7\bin

%hdir%\bin\harbour %1 /n -DHB_DYNLIB /i..\include;%hdir%\include /w /p %2 %3 > clip.log 2> warnings.log
@type clip.log
@type warnings.log
IF ERRORLEVEL 1 PAUSE
IF ERRORLEVEL 1 GOTO EXIT

echo -O2 -I%hdir%\include %1.c > b32.bc
%bcdir%\bcc32 -M -c @b32.bc
:ENDCOMPILE

IF EXIST %1.rc %bcdir%\brc32 -r %1

echo c0d32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.dll, + >> b32.bc
echo %1.map, + >> b32.bc
echo %hdir%\lib\hbmaindllp.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\cw32.lib, >> b32.bc

IF EXIST %1.res echo %1.res >> b32.bc
%bcdir%\ilink32 -Tpd -aa @b32.bc

IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * pcode DLL successfully built
GOTO EXIT
ECHO

rem delete temporary files
rem @del %1.c
@del %1.il?

:LINKERROR
ECHO * There are errors
GOTO EXIT

:SINTAX
ECHO    SYNTAX: Build [Program]     {-- No especifiques la extensi¢n PRG
ECHO                                {-- Don't specify .PRG extension
GOTO EXIT

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT


You can only use nFreeze with Class TXBrowse but I am not sure if it is fully operative in your version. Please try it, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Setfocus problem

Postby reds » Thu May 03, 2018 1:54 pm

Antonio

Thanks for the batch files

TXbrowse gave me this
Peter


Code: Select all  Expand view  RUN

Compiling...
Harbour 3.4.0dev () (2014-09-28 23:40)
Copyright (c) 1999-2014, https://github.com/vszakats/harbour-core/

Lines 1742, Functions/Procedures 1
Generating C source output to 'XBRW.c'... Done.
XBRW.c
FiveCEC.lib(XBROWSEC.obj) : error LNK2005: HB_FUN_XBRWSCROLLROW already defined in FiveCE.lib(XBROWSE.obj)
FiveCE.lib(XBROWSE.obj) : error LNK2001: unresolved external symbol HB_FUN_PALBMPFREE
FiveCE.lib(TREES.obj) : error LNK2001: unresolved external symbol HB_FUN_PALBMPFREE
FiveCE.lib(XBROWSE.obj) : error LNK2001: unresolved external symbol HB_FUN_DBSKIPPER
XBRW.exe : fatal error LNK1120: 2 unresolved externals
* Linking errors *
 
reds
 
Posts: 50
Joined: Tue May 16, 2017 12:19 pm
Location: North London

Re: Setfocus problem

Postby Antonio Linares » Thu May 03, 2018 7:00 pm

Peter,

Please remove the function XBRWSCROLLROW() from xbrowse.prg

and implement these functions:

function PalBmpFree( hBmp, hPal )

DeleteObject( hBmp )
DeleteObject( hPal )

return nil

function DbSkipper( n )

return __DbSkipper( n )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Setfocus problem

Postby reds » Fri May 18, 2018 12:27 pm

Antonio
So how do these changes get picked up?

Do I create a new Xbrowse obj and replace it in fivece.lib

Regards
Peter
p.s. sorry for late reply,I've been away
reds
 
Posts: 50
Joined: Tue May 16, 2017 12:19 pm
Location: North London

Re: Setfocus problem

Postby Antonio Linares » Sat May 19, 2018 7:56 am

Peter,

Please add these changes in your main PRG and lets see if the unresolved externals get solved
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Setfocus problem

Postby reds » Mon May 21, 2018 8:05 am

Antonio

Just getting
>> FiveCEC.lib(XBROWSEC.obj) : error LNK2005: HB_FUN_XBRWSCROLLROW already defined in FiveCE.lib(XBROWSE.obj)

I've also tried to use date picker and I'm getting this

>>FiveCE.lib(TDTPICKE.obj) : error LNK2001: unresolved external symbol HB_FUN_INITCOMMON
>>FiveCE.lib(TDTPICKE.obj) : error LNK2001: unresolved external symbol HB_FUN_GETDATEPICK
>>FiveCE.lib(TDTPICKE.obj) : error LNK2001: unresolved external symbol HB_FUN_SETDATEPICK

Regards
Peter
reds
 
Posts: 50
Joined: Tue May 16, 2017 12:19 pm
Location: North London


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 2 guests