How do i call a procedure

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

Re: How do i call a procedure

Post 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
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: How do i call a procedure

Post by apais »

I don't understand your question.
BTW here are you from ?
Angel Pais
Web Apps consultant/architect/developer.
HW_apache (webserver modules) co-developer.
HbTron (Html GUI for harbour desktop hybrid apps) co-developer.
https://www.hbtron.com
ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

Re: How do i call a procedure

Post 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
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: How do i call a procedure

Post 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
Angel Pais
Web Apps consultant/architect/developer.
HW_apache (webserver modules) co-developer.
HbTron (Html GUI for harbour desktop hybrid apps) co-developer.
https://www.hbtron.com
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: How do i call a procedure

Post 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
Angel Pais
Web Apps consultant/architect/developer.
HW_apache (webserver modules) co-developer.
HbTron (Html GUI for harbour desktop hybrid apps) co-developer.
https://www.hbtron.com
ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

Re: How do i call a procedure

Post 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
Attachments
My small app
My small app
Menu.jpg (427.89 KiB) Viewed 4274 times
Last edited by ROBROS on Tue Aug 08, 2017 1:27 pm, edited 1 time in total.
ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

Re: How do i call a procedure

Post 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.
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: How do i call a procedure

Post by serge_girard »

Robert,

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

Serge
There's nothing you can do that can't be done...
ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

Re: How do i call a procedure

Post 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
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: How do i call a procedure

Post 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
There's nothing you can do that can't be done...
Post Reply