Page 2 of 8

Re: How do i call a procedure

Posted: Fri Jul 21, 2017 6:15 pm
by ROBROS
edk wrote: Wed Jul 19, 2017 10:57 pm You can also add all .prg files references into .hbp project file and compile to one exe. All functions and procedures will be included.
It's me again, but I have so much to learn:
Is it right that procedures can only be inside a *.prg file?

BTW: It's fun programming with HMG and having this forum, you know, I'm not a professional coder.

Robert

Re: How do i call a procedure

Posted: Fri Jul 21, 2017 7:22 pm
by apais
I don't understand your question.
BTW here are you from ?

Re: How do i call a procedure

Posted: Fri Jul 21, 2017 7:50 pm
by ROBROS
apais wrote: Fri Jul 21, 2017 7:22 pm I don't understand your question.
BTW here are you from ?
Hi,
What I mean is: I write a source code and save it to a *.prg file, in this file I can call procedures ( do procedure) that are part of this *.prg file. Can I call a procedure which is not part of the *.prg file?

I come from Germany, to be exact from the south of Germany, known as Bayern, capital Munic, (Bavaria).

Robert

Re: How do i call a procedure

Posted: Fri Jul 21, 2017 8:20 pm
by apais
Yes you can.
Unless it is a STATIC PROCEDURE

STATIC PROCEDURE and/or FUNCTION can only be called from the same .prg

The difference among a PROCEDURE and a FUNCTION ?

PROCEDURES allways RETURN NIL
FUNCTIONS can RETURN any value

HTH
Angel

Re: How do i call a procedure

Posted: Fri Jul 21, 2017 8:23 pm
by apais
AND...

there's no need to use DO ( It's deprecated in clipper since ages )
simply call the procedure by it's name.

PROCEDURE Main()
proc1()
proc2()
return

Re: How do i call a procedure

Posted: Tue Aug 08, 2017 12:21 pm
by ROBROS
Hi @ everyone,
my small app is growing, the following code (i have left out the main window stuff) shows how i call procedures,
the first 2 items with no need for a user dialog "Tagesdatum" what means daily data, are working just fine.

Now I want the user select per datepicker a start date and en end date for a report. The records are appended to dbf file.

I call a procedure datum() and get the following error:

Control: date.1 of win_1 not defined,
the error is caused by main(46)=activate Window win_1.



DEFINE POPUP 'D&aten'
ITEM 'Tagesdaten bereitstellen' ACTION woche()
ITEM 'Tagesdaten einlesen' ACTION filltag()
ITEM 'Enter date' ACTION datum()
END POPUP

DEFINE POPUP 'F&ahrerstamm'
ITEM 'Suchen' ACTION suchen()
END POPUP


END MENU

END WINDOW


ACTIVATE WINDOW Win_1



Return

procedure datum
Win_1.date_1.Value:=Date()
@ 80,10 DATEPICKER date()
return

I do not have a main.fmg window, is this necessary?
And how do I call that control, where is the link between my main.prg and those many useful controls?

I hope you can give me help.

Regards Robert

Re: How do i call a procedure

Posted: Tue Aug 08, 2017 12:32 pm
by ROBROS
BTW:
If I define the date_1 of win_1 via item action (like shown in the sample) the datepicker shows up permanently, but I want to show it only up, when called.

Re: How do i call a procedure

Posted: Tue Aug 08, 2017 1:50 pm
by serge_girard
Robert,

Better send the whole package of PRG, FMG etc. Now it is incomplete and difficult to see what wrong.

Serge

Re: How do i call a procedure

Posted: Tue Aug 08, 2017 2:50 pm
by ROBROS
Hi Serge,

Is there a way to attach the files or must I copy and paste the content of the files?

Regards Robert

Re: How do i call a procedure

Posted: Tue Aug 08, 2017 4:04 pm
by serge_girard
Hi Robert,

Just put it in a ZIP file and then go to 'Full Editor & Preview' then you can add files!

Serge