HELP!

HELP!

Postby davidlim » Tue May 13, 2008 3: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.
davidlim
 
Posts: 12
Joined: Tue May 06, 2008 10:26 am

Postby James Bott » Tue May 13, 2008 6: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

HELP!

Postby david lim » 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
david lim
 
Posts: 2
Joined: Wed Apr 30, 2008 6:50 am
Location: malaysia

Postby James Bott » Wed May 14, 2008 6: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby davidlim » Wed May 14, 2008 7: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
davidlim
 
Posts: 12
Joined: Tue May 06, 2008 10:26 am

Postby dutch » Wed May 14, 2008 7:10 am

Dear David,

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

Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

HELP!

Postby david lim » Wed May 14, 2008 7: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
david lim
 
Posts: 2
Joined: Wed Apr 30, 2008 6:50 am
Location: malaysia

NEW METHOD!

Postby davidlim » Wed May 14, 2008 8:07 am

Please advise the easier and simple way of doing CUSTOMER MASTER MAINTENANCE (NEW, EDIT, DELETE, SEARCH), Thanks.
davidlim
 
Posts: 12
Joined: Tue May 06, 2008 10:26 am

Re: HELP!

Postby dutch » Wed May 14, 2008 8:19 am

david lim wrote:Here is the SelectCode() function:-

...

function SelectCode( oGetCodex, cCodex )

select 1
* set softseek on
* seek cCodex
Code: Select all  Expand view
   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.
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

HELP!

Postby davidlim » 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?
davidlim
 
Posts: 12
Joined: Tue May 06, 2008 10:26 am

Re: HELP!

Postby dutch » Wed May 14, 2008 4: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 "@!"
Code: Select all  Expand view
      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

Code: Select all  Expand view
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
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

THANKS

Postby davidlim » Wed May 14, 2008 10:12 pm

Thanks and appreciate for your kind attention and help, DUTCH.
davidlim
 
Posts: 12
Joined: Tue May 06, 2008 10:26 am

HELP!

Postby davidlim » 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.
davidlim
 
Posts: 12
Joined: Tue May 06, 2008 10:26 am

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

HELP!

Postby davidlim » 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?
davidlim
 
Posts: 12
Joined: Tue May 06, 2008 10:26 am

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 69 guests