Page 1 of 2

call a MENUITEM "from Function" ?

Posted: Sun Jun 06, 2021 1:21 am
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" )

Re: call a MENUITEM "from Function" ?

Posted: Sun Jun 06, 2021 3:24 am
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()

Re: call a MENUITEM "from Function" ?

Posted: Sun Jun 06, 2021 6:30 pm
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 ...

Re: call a MENUITEM "from Function" ?

Posted: Sun Jun 06, 2021 6:59 pm
by Rathinagiri
Why not this?

Code: Select all

Create Event ProcName ImageWheelEvent1()

Function ImageWheelEvent1()
   ImageWheelEvent( Parameter ... )

Re: call a MENUITEM "from Function" ?

Posted: Sun Jun 06, 2021 8:39 pm
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 :?:

Re: call a MENUITEM "from Function" ?

Posted: Mon Jun 07, 2021 1:30 am
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.

Re: call a MENUITEM "from Function" ?

Posted: Mon Jun 07, 2021 10:31 am
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

Re: call a MENUITEM "from Function" ?

Posted: Mon Jun 07, 2021 5:02 pm
by andyglezl
PUBLIC a,b,c,d

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

work...

Re: call a MENUITEM "from Function" ?

Posted: Tue Jun 08, 2021 2:45 pm
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)

Re: call a MENUITEM "from Function" ?

Posted: Tue Jun 08, 2021 3:48 pm
by franco
You could use PRIVATE which I think gets released when calling function is released.
PRIVATE a,b,c,d