FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HELP!
Posts: 12
Joined: Tue May 06, 2008 10:26 AM
HELP!
Posted: Tue May 13, 2008 03:00 PM

(1) Customer maintenance program: once I enter the customer code, IF the code exist, I want the program to retrive the information from the customer master file, NAME, ADDRESS, etc ..., and ready for amendment instead of POPUP a selection box for customer selection. THE problem I am facing now was when I enter a customer code and press enter, it will prompt up a selection box for customer selection, no matter the customer exist or not.

Thanks and appreciate for Helps.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
HELP!
Posted: Tue May 13, 2008 06:09 PM

I am not clear. Are you a user or a programmer? Did you write the code or did someone else?

What do you mean by, "eady for amendment." Are you adding customer information to something else, like an order?

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 2
Joined: Wed Apr 30, 2008 06:50 AM
HELP!
Posted: Wed May 14, 2008 12:09 AM

Is in customer master maintenance. When I enter customer code, if the code already exist in the customer master, I want the program jump to amendment of NAME, ADDRESS, TEL, etc, instead of POPUP a customer selection box. I want to know the command to bypass the POPUP. Thanks and appreciate for your kind attention.

asking for help and willing to help others
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
HELP!
Posted: Wed May 14, 2008 06:19 AM

>I want to know the command to bypass the POPUP.

I still don't know if you are a programmer or a user?

If you are a programmer, then we need to see your source code.

If you are user, then what you want is not possible without the source code. Do you have the source code?

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 12
Joined: Tue May 06, 2008 10:26 AM
HELP!
Posted: Wed May 14, 2008 07:00 AM

yes, i am programmer, just pick up FWH, quit confuse with DEFINE and REDEFINE, here is the source codes:-

DEFINE DIALOG oDlg RESOURCE "DebtorMaintenance"

REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!"

REDEFINE BTNBMP oBtn1 ID 115 OF oDlg
FILENAME "c:\fwh\bitmaps\search.bmp" ACTION ( SelectCode(
oGetCode, cCode ), oGetName:VarPut( ArCust->Name ) ,;
oGetAdd1:VarPut( ArCust->Add1 ) ,;
oGetAdd2:VarPut( ArCust->Add2 ) ,;
oGetTeln:VarPut( ArCust->Teln ) ,;
oGetFaxn:VarPut( ArCust->Faxn ) ,;
oGetName:Refresh() ,;
oGetAdd1:Refresh() ,;
oGetAdd2:Refresh() ,;
oGetTeln:SetFocus() ,;
oGetFaxn:Refresh() ,;
oGetName:SetFocus() )

REDEFINE GET oGetName VAR cName ID 120 OF oDlg VALID ! Empty(
cName )

REDEFINE GET oGetAdd1 VAR cAdd1 ID 130 OF oDlg

REDEFINE GET oGetAdd2 VAR cAdd2 ID 140 OF oDlg

REDEFINE GET oGetTeln VAR cTeln ID 150 OF oDlg

REDEFINE GET oGetFaxn VAR cFaxn ID 160 OF oDlg

REDEFINE BUTTON ID ID_SAVE OF oDlg ACTION ( lSave := .T.,
oDlg:End() )

REDEFINE BUTTON ID ID_DELETE OF oDlg ACTION ( lDelete := .T.,
oDlg:End() )

REDEFINE BUTTON ID ID_CANCEL OF oDlg ACTION oDlg:End() CANCEL

ACTIVATE DIALOG oDlg CENTERED

...

Thanks and appreciate for your kind attention and help.


asking for help and willing to help others

Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
HELP!
Posted: Wed May 14, 2008 07:10 AM

Dear David,

You must show SelectCode() function. It is the main point you mention.

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 2
Joined: Wed Apr 30, 2008 06:50 AM
HELP!
Posted: Wed May 14, 2008 07:21 AM

Here is the SelectCode() function:-

...

function SelectCode( oGetCodex, cCodex )

select 1
set softseek on
seek cCodex
set softseek off

ArCust->( DbChoice( "Select a customer", 1 ) )

oGetCodex:VarPut( AllTrim( ArCust->Code ) )

oGetCodex:Refresh() // repaints the GET

return nil

function DbChoice( cTitle, cSelect )

local oDlg, oBrw

DEFINE DIALOG oDlg RESOURCE "DbChoice" TITLE cTitle

if cSelect = 1
REDEFINE LISTBOX oBrw ;
FIELDS ArCust->Code, ArCust->Name ;
HEADERS "Code", "Name" ;
ID 100 OF oDlg
endif

ACTIVATE DIALOG oDlg CENTERED

return nil

...

Thanks and appreciate for your kind attention and help.

asking for help and willing to help others
Posts: 12
Joined: Tue May 06, 2008 10:26 AM
NEW METHOD!
Posted: Wed May 14, 2008 08:07 AM

Please advise the easier and simple way of doing CUSTOMER MASTER MAINTENANCE (NEW, EDIT, DELETE, SEARCH), Thanks.

Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: HELP!
Posted: Wed May 14, 2008 08:19 AM
david lim wrote:Here is the SelectCode() function:-

...

function SelectCode( oGetCodex, cCodex )

select 1
* set softseek on
* seek cCodex
   if ArCust->(DbSeek( cCodex ))
      if ArCust->Code==cCodex
         return nil
      end
   end

* set softseek off

ArCust->( DbChoice( "Select a customer", 1 ) )

oGetCodex:VarPut( AllTrim( ArCust->Code ) )

oGetCodex:Refresh() // repaints the GET

return nil

function DbChoice( cTitle, cSelect )

local oDlg, oBrw

DEFINE DIALOG oDlg RESOURCE "DbChoice" TITLE cTitle

if cSelect = 1
REDEFINE LISTBOX oBrw ;
FIELDS ArCust->Code, ArCust->Name ;
HEADERS "Code", "Name" ;
ID 100 OF oDlg
endif

ACTIVATE DIALOG oDlg CENTERED

return nil

...

Thanks and appreciate for your kind attention and help.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 12
Joined: Tue May 06, 2008 10:26 AM
HELP!
Posted: Wed May 14, 2008 11:08 AM

Thanks & appreciate for kind attention and help.

  . . .

  DEFINE DIALOG oDlg RESOURCE "DebtorMaintenance"

  REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!"

  REDEFINE BTNBMP oBtn1 ID 115 OF oDlg 
        FILENAME "c:\fwh\bitmaps\search.bmp" ACTION ( SelectCode( 
        oGetCode, cCode ), oGetName:VarPut( ArCust->Name ) ,;
                          oGetAdd1:VarPut( ArCust->Add1 ) ,;
                                      . . .              
                                      oGetEmai:Refresh() ,;
              oGetReps:Refresh() , oGetName:SetFocus() )

  REDEFINE GET oGetName VAR cName ID 120 OF oDlg VALID ! Empty
        ( cName )

  REDEFINE GET oGetAdd1 VAR cAdd1 ID 130 OF oDlg

  . . .

function SelectCode( oGetCodex, cCodex )
if Empty( cCodex )
DbGoTop()
ArCust->( DbChoice( "Select a customer", 1 ) )
else
Select 1
ArCust->( DbSeek( cCodex ) )
if ArCust->Code==cCodex
return nil
else
set softseek on
seek cCodex
set softseek off
ArCust->( DbChoice( "Select a customer", 1 ) )
endif
endif

oGetCodex:VarPut( ArCust->Code )
oGetCodex:Refresh()
return nil

(1) would like to find out WHY empty customer code still valid to save?
(2) for DbChoice, to select a customer, HOW to activate an enter key instead of click on OK button for selection?

Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: HELP!
Posted: Wed May 14, 2008 04:31 PM
Dear David,

Pls try this.

davidlim wrote:Thanks & appreciate for kind attention and help.

. . .

DEFINE DIALOG oDlg RESOURCE "DebtorMaintenance"

* REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!"
      REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!"  ;
                     VALID (if(empty(cCode),.F.,(SelectCode( oGetCode, cCode ),.T.))

REDEFINE BTNBMP oBtn1 ID 115 OF oDlg
FILENAME "c:\fwh\bitmaps\search.bmp" ACTION ( SelectCode(
oGetCode, cCode ), oGetName:VarPut( ArCust->Name ) ,;
oGetAdd1:VarPut( ArCust->Add1 ) ,;
. . .
oGetEmai:Refresh() ,;
oGetReps:Refresh() , oGetName:SetFocus() )

REDEFINE GET oGetName VAR cName ID 120 OF oDlg VALID ! Empty
( cName )

REDEFINE GET oGetAdd1 VAR cAdd1 ID 130 OF oDlg

REDEFINE BUTTON ID ID_SAVE OF oDlg WHEN !empty(cCode) ;
ACTION ( lSave := .T., oDlg:End() )

. . .

function SelectCode( oGetCodex, cCodex )
if Empty( cCodex )
DbGoTop()
ArCust->( DbChoice( "Select a customer", 1 ) )
else
Select 1
ArCust->( DbSeek( cCodex ) )
if ArCust->Code==cCodex
return nil
else
set softseek on
seek cCodex
set softseek off
ArCust->( DbChoice( "Select a customer", 1 ) )
endif
endif

oGetCodex:VarPut( ArCust->Code )
oGetCodex:Refresh()
return nil


(1) would like to find out WHY empty customer code still valid to save?
(2) for DbChoice, to select a customer, HOW to activate an enter key instead of click on OK button for selection?


Regards,
Dutch
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 12
Joined: Tue May 06, 2008 10:26 AM
THANKS
Posted: Wed May 14, 2008 10:12 PM

Thanks and appreciate for your kind attention and help, DUTCH.

Posts: 12
Joined: Tue May 06, 2008 10:26 AM
HELP!
Posted: Wed May 14, 2008 10:22 PM

i got 20+ programming years (start from programmer -> analyst programmer -> systems analyst -> project manager -> software developer). program logic and data flow are totally not a problem to me, but why i still can't manage to solve this simple customer master maintenance program in gui environment! i am so sorry, but i really need helping hand from all of you. THANKS AND APPRECIATE TO ALL OF YOU.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
HELP!
Posted: Wed May 14, 2008 10:31 PM

David,

I have written some articles about programming in FW which may help. They are available on my website here:

http://ourworld.compuserve.com/homepage ... rogram.htm

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 12
Joined: Tue May 06, 2008 10:26 AM
HELP!
Posted: Wed May 14, 2008 10:36 PM

i did follow what DUTCH show me,
(1) BUT when the 1st screen come out, ask for customer code, i just press enter without keying anything, the program end without saving the empty record.
(2) IF i enter any character, like A or Z, and press enter, it will simply save the record and end the program.
(3) the customer code i set to 8 characters, if i entered all the 8 characters and the focus go to next SEARCH button, it will now popup customer selection

where and what missing?