#include "FiveTouch.ch"
*--------------
FUNCTION Main()
*--------------
local oDlg
local hCtrl := { => }
USE .\data\test
DEFINE DIALOG oDlg SIZE 250, 400 TITLE "Test DBF"
DEFINE BAR oQToolBar OF oDlg
DEFINE BUTTONBAR hCtrl[ 'btn_exit' ] OF oQToolBar IMAGE 'bmp\exit.bmp' ;
ACTION Quit();
TOOLTIP 'Exit'
DEFINE SEPARATOR OF oQToolBar
DEFINE BUTTONBAR hCtrl[ 'btn_top' ] OF oQToolBar IMAGE 'bmp\top.bmp' ;
ACTION Navigator( 'top', hCtrl );
TOOLTIP 'Top table'
DEFINE BUTTONBAR hCtrl[ 'btn_prev' ] OF oQToolBar IMAGE 'bmp\prev.bmp' ;
ACTION Navigator( 'prev', hCtrl );
TOOLTIP 'Previous register'
DEFINE BUTTONBAR hCtrl[ 'btn_next' ] OF oQToolBar IMAGE 'bmp\next.bmp' ;
ACTION Navigator( 'next', hCtrl );
TOOLTIP 'Next register'
DEFINE BUTTONBAR hCtrl[ 'btn_bottom' ] OF oQToolBar IMAGE 'bmp\bottom.bmp' ;
ACTION Navigator( 'bottom', hCtrl );
TOOLTIP 'Bottom table'
@80, 10 SAY oSay PROMPT "First" OF oDlg
@110, 10 SAY oSay PROMPT "Last" OF oDlg
@140, 10 SAY oSay PROMPT "Age" OF oDlg
@80, 100 GET hCtrl[ 'first' ] VAR '' OF oDlg
@110, 100 GET hCtrl[ 'last' ] VAR '' OF oDlg
@140, 100 GET hCtrl[ 'age' ] VAR '' OF oDlg
hCtrl[ 'age' ]:resize( 40, 20 )
@180, 40 IMAGE hCtrl[ 'image' ] FILE 'dvd.png' SIZE 170, 200 OF oDlg
ShowData( hCtrl )
ACTIVATE DIALOG oDlg
DbCloseAll()
return nil
*---------------------------------------
STATIC FUNCTION Navigator( cCmd, hCtrl )
*---------------------------------------
DO CASE
CASE cCmd == 'top' ; DbGoTop()
CASE cCmd == 'bottom' ; DbGoBottom()
CASE cCmd == 'next'
if !eof()
DbSkip()
endif
CASE cCmd == 'prev'
DbSkip(-1)
ENDCASE
ShowData( hCtrl )
retu nil
#define F_FIRST 1
#define F_LAST 2
#define F_AGE 9
*--------------------------------
STATIC FUNCTION ShowData( hCtrl )
*--------------------------------
LOCAL nRecno := Recno()
LOCAL cFile := 'data\cara' + ltrim(str(nRecno)) + '.bmp'
hCtrl[ 'first' ]:SetText( FieldGet( F_FIRST ) )
hCtrl[ 'last' ]:SetText( FieldGet( F_LAST ) )
hCtrl[ 'age' ]:SetText( Str( FieldGet( F_AGE ), 2 ) )
hCtrl[ 'image' ]:SetPixmap( QPixmap( cFile ) )
retu nil
Users browsing this forum: No registered users and 0 guests