How do i call a procedure

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

ROBROS
Posts: 60
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 32 times
Been thanked: 1 time

Re: How do i call a procedure

Post by ROBROS » Fri Jul 21, 2017 6:15 pm

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: 257
Joined: Fri Aug 01, 2008 6:03 pm
Location: uruguay
Has thanked: 23 times
Been thanked: 15 times
Contact:

Post by apais » Fri Jul 21, 2017 7:22 pm

I don't understand your question.
BTW here are you from ?

ROBROS
Posts: 60
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 32 times
Been thanked: 1 time

Post by ROBROS » Fri Jul 21, 2017 7:50 pm

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: 257
Joined: Fri Aug 01, 2008 6:03 pm
Location: uruguay
Has thanked: 23 times
Been thanked: 15 times
Contact:

Post by apais » Fri Jul 21, 2017 8:20 pm

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

User avatar
apais
Posts: 257
Joined: Fri Aug 01, 2008 6:03 pm
Location: uruguay
Has thanked: 23 times
Been thanked: 15 times
Contact:

Post by apais » Fri Jul 21, 2017 8:23 pm

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

ROBROS
Posts: 60
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 32 times
Been thanked: 1 time

Post by ROBROS » Tue Aug 08, 2017 12:21 pm

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
Menu.jpg
My small app
Menu.jpg (427.89 KiB) Viewed 164 times
Last edited by ROBROS on Tue Aug 08, 2017 1:27 pm, edited 1 time in total.

ROBROS
Posts: 60
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 32 times
Been thanked: 1 time

Post by ROBROS » Tue Aug 08, 2017 12:32 pm

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: 1839
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 279 times
Been thanked: 65 times
Contact:

Post by serge_girard » Tue Aug 08, 2017 1:50 pm

Robert,

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

Serge

ROBROS
Posts: 60
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 32 times
Been thanked: 1 time

Post by ROBROS » Tue Aug 08, 2017 2:50 pm

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: 1839
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 279 times
Been thanked: 65 times
Contact:

Post by serge_girard » Tue Aug 08, 2017 4:04 pm

Hi Robert,

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

Serge

Post Reply