call a MENUITEM "from Function" ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

call a MENUITEM "from Function" ?

Post by AUGE_OHR »

hi,

i do have a CONTEXT MENU and 3 MENUITEM with ACTION
is it possible to activate MENUITEM from a Function :idea:

Code: Select all

   // i want to activate 2nd MENUITEM
   DoMethod("Form_1", "MYMENU", 2, "ACTION" )
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: call a MENUITEM "from Function" ?

Post by andyglezl »

Y porque no directamente...
*-------------------------------------
And why not directly ...

DEFINE CONTROL CONTEXT MENU LB_ColFillArea OF Win_Ctrls
MENUITEM "item 1" ACTION Action1fromMyMenu()
MENUITEM "item 2" ACTION Action2fromMyMenu()

// i want to activate 2nd MENUITEM
Action2fromMyMenu()
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: call a MENUITEM "from Function" ?

Post by AUGE_OHR »

hi,

to call MENUITEM direct was just a Idea.

i have to paas some Parameter but i can not use Parameter at

Code: Select all

   CREATE EVENT PROCNAME ImageWheelEvent(Parameter ...)
while MENUITEM have those Parameter i thought ...
have fun
Jimmy
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: call a MENUITEM "from Function" ?

Post by Rathinagiri »

Why not this?

Code: Select all

Create Event ProcName ImageWheelEvent1()

Function ImageWheelEvent1()
   ImageWheelEvent( Parameter ... )
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: call a MENUITEM "from Function" ?

Post by AUGE_OHR »

hi,
Rathinagiri wrote: Sun Jun 06, 2021 6:59 pm

Code: Select all

Create Event ProcName ImageWheelEvent1()

Function ImageWheelEvent1()
   ImageWheelEvent( Parameter ... )
hm ... where do i get "Parameter" from :?:
have fun
Jimmy
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: call a MENUITEM "from Function" ?

Post by Rathinagiri »

Can't you use the same parameter from the menuitem?

I don't understand the context. Please post a small working sample. Let me try.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: call a MENUITEM "from Function" ?

Post by AUGE_OHR »

hi,
Rathinagiri wrote: Mon Jun 07, 2021 1:30 am Can't you use the same parameter from the menuitem?

I don't understand the context. Please post a small working sample. Let me try.

Code: Select all

LOCAL a,b,c,d

Create Event ProcName ImageWheelEvent(a,b,c,d)

Function ImageWheelEvent(a,b,c,d)
Error BASE/1003 Variable does not exist a
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: call a MENUITEM "from Function" ?

Post by andyglezl »

PUBLIC a,b,c,d

Create Event ProcName ImageWheelEvent( a,b,c,d) HWND ImageEdit.HANDLE STOREINDEX nIndex

work...
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: call a MENUITEM "from Function" ?

Post by AUGE_OHR »

hi,,

thx for help
andyglezl wrote: Mon Jun 07, 2021 5:02 pm PUBLIC a,b,c,d
YES it work that Way ...
andyglezl wrote: Mon Jun 07, 2021 5:02 pm Create Event ProcName ImageWheelEvent( a,b,c,d) HWND ImageEdit.HANDLE STOREINDEX nIndex
work...
but if i use PUBLIC i do not need Parameter

---

i try to avoid PUBLIC if possible as i have use "too much" when start with Cl*pper where i got LOCAL

i found a Tool called "Summer 93" which does make FUNCTION of each PUBLIC.

Code: Select all

FUNCTION ABC(xValue)
STATIC MyValue := 0
   IF PCOUNT() > 0
      MyValue := xValue
   ENDIF
RETURN MyValue
this Way i got rid of PUBLIC (which need limited DGROUP Space)
have fun
Jimmy
franco
Posts: 818
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: call a MENUITEM "from Function" ?

Post by franco »

You could use PRIVATE which I think gets released when calling function is released.
PRIVATE a,b,c,d
All The Best,
Franco
Canada
Post Reply