How do i call a procedure
Moderator: Rathinagiri
How do i call a procedure
Hi to all,
my first small programs run in hmg with very few modifications. I created a main procedure with main window as shown in the samples, I can call procedures from procedure main. When all procedures are done, main window shows up and I have do terminate the program by clickin on "x" in the upper right corner.
Is there a way to call procedures from a popup like shown below, and what are the appropriate commands?
#include "hmg.ch"
Function Main
DEFINE WINDOW Win_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 200 ;
TITLE 'Tutor 02 - Property Test' ;
MAIN
DEFINE MAIN MENU
POPUP "First Popup"
ITEM 'Change Window Title' ACTION Win_1.Title := 'New Title' &&on select this do proc1
ITEM 'Retrieve Window Title' ACTION MsgInfo ( Win_1.Title ) &&on select this do proc2
END POPUP
END MENU
END WINDOW
ACTIVATE WINDOW Win_1
Return
I couldn't find a suiting sample so far and hope you can help.
Thank you
Robert
my first small programs run in hmg with very few modifications. I created a main procedure with main window as shown in the samples, I can call procedures from procedure main. When all procedures are done, main window shows up and I have do terminate the program by clickin on "x" in the upper right corner.
Is there a way to call procedures from a popup like shown below, and what are the appropriate commands?
#include "hmg.ch"
Function Main
DEFINE WINDOW Win_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 200 ;
TITLE 'Tutor 02 - Property Test' ;
MAIN
DEFINE MAIN MENU
POPUP "First Popup"
ITEM 'Change Window Title' ACTION Win_1.Title := 'New Title' &&on select this do proc1
ITEM 'Retrieve Window Title' ACTION MsgInfo ( Win_1.Title ) &&on select this do proc2
END POPUP
END MENU
END WINDOW
ACTIVATE WINDOW Win_1
Return
I couldn't find a suiting sample so far and hope you can help.
Thank you
Robert
Re: How do i call a procedure
Add following code:
ITEM "E&xit" ACTION Win_1.Release
ITEM "E&xit" ACTION Win_1.Release
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG
Re: How do i call a procedure
You can "do procedure" in the same way as call function.
Code: Select all
ITEM 'Change Window Title' ACTION proc1() &&on select this do proc1
ITEM 'Retrieve Window Title' ACTION proc2() &&on select this do proc2
Re: How do i call a procedure
@ BPD Thank you: ITEM "&EXIT" ... is very useful I tried "deactivate"
@ edk: I tried do procedure.
Many thanks
Robert
@ edk: I tried do procedure.
Many thanks
Robert
Re: How do i call a procedure
Here I am back again.
@ edk: your suggestion doesn't work. Are there any settings to be done to make it work?
But another question: maybe 2 weeks ago I stumbled across a fully featured demo-program with checkbox, datepicker, calendar function and on and on, but I can't find the site again. Anybody an idea?
Regards
Robert
@ edk: your suggestion doesn't work. Are there any settings to be done to make it work?
But another question: maybe 2 weeks ago I stumbled across a fully featured demo-program with checkbox, datepicker, calendar function and on and on, but I can't find the site again. Anybody an idea?
Regards
Robert
Re: How do i call a procedure
Strange, this code work like a charm:
Code: Select all
#include "hmg.ch"
Function Main
DEFINE WINDOW Win_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 200 ;
TITLE 'Tutor 02 - Property Test' ;
MAIN
DEFINE MAIN MENU
POPUP "First Popup"
ITEM 'DO proc1' ACTION proc1() &&on select this do proc1
ITEM 'DO proc2' ACTION proc2() &&on select this do proc2
ITEM "E&xit" ACTION ThisWindow.Release
END POPUP
END MENU
END WINDOW
ACTIVATE WINDOW Win_1
Return
*********************************
PROCEDURE proc1
Local i
FOR i=1 TO 100
i:=i*i
Next i
MsgInfo('Result: '+hb_ValToStr(i), 'proc1')
RETURN
*********************************
PROCEDURE proc2
Local i
FOR i=1 TO 100
i:=i+i
Next i
MsgInfo('Result: '+hb_ValToStr(i), 'proc2')
RETURN
There may be helpful samples from the HMG installation:But another question: maybe 2 weeks ago I stumbled across a fully featured demo-program with checkbox, datepicker, calendar function and on and on, but I can't find the site again.
c:\hmg.3.4.4\SAMPLES\Basics\MAIN_DEMO\
c:\hmg.3.4.4\SAMPLES\Controls\MonthCalendar\
Re: How do i call a procedure
Thank you very much, MAIN_DEMO is, what I was looking for, I searched the web for it, and it is part of HMG-distribution, by Roberto Lopez.
Regards
Robert
Regards
Robert
Re: How do i call a procedure
@ edk: Sorry, absolutely my fault.
Up to now I used xbase++ in text mode, compiled the single prg-files and called them sequently via command line *.bat.
Robert
Up to now I used xbase++ in text mode, compiled the single prg-files and called them sequently via command line *.bat.
Robert
Re: How do i call a procedure
You can also add all .prg files references into .hbp project file and compile to one exe. All functions and procedures will be included.
Re: How do i call a procedure
FEEDBACK:
I did how you told me, works just fine.
Thank you
Robert
I did how you told me, works just fine.
Thank you
Robert