Re: Contextual Cut, Copy & Paste...?

2017-06-27 Thread Keisuke Miyako via 4D_Tech
the source code for this example is lost,
but an early version (with bugs) is still hosted here:

http://forums.4d.fr/Post//6273875/1

> 2017/06/27 17:51、Keisuke Miyako via 4D_Tech <4d_tech@lists.4d.com> のメール:
>
> http://sources.4d.com/trac/4d_keisuke/wiki/CustomContextualMenu




**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Contextual Cut, Copy & Paste...?

2017-06-27 Thread Keisuke Miyako via 4D_Tech
contextual (or otherwise) click on an editable text input is only available in 
v14 or later,
in older version you need to work around with ON EVENT CALL.

http://sources.4d.com/trac/4d_keisuke/wiki/CustomContextualMenu

but then, if your are on v14 or later,
you could simply use the built-in contextual menu...

> 2017/06/27 9:47、Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> のメール:
> On clicked event with Contextual Click.



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Contextual Cut, Copy & Paste...?

2017-06-26 Thread Kirk Brooks via 4D_Tech
Robert,

I second Tim's approach - just build your own menu based on the On clicked
event with Contextual Click. I don't think a user could tell the difference
between it being a '4D menu' and an 'OS menu'. I'm not even sure there is
any.

The only thing I'd do differently is not bother with an IP var for the menu
ref. Just use it and loose it:

$menu:=Create menu

APPEND MENU ITEM($menu;"Cut")
SET MENU ITEM PARAMETER($menu;-1;"cut")

APPEND MENU ITEM($menu;"Copy")
SET MENU ITEM PARAMETER($menu;-1;"copy")

etc

// display the menu, get the result, clear the menu
$result:=Dynamic pop up menu($menu)
RELEASE MENU($menu)

Case of
  :($result="cut")
  
End case




On Wed, Jun 21, 2017 at 7:05 PM, Robert ListMail via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Is there a way to use the contextual menu of the host OS (Mac or Windows)
> for Cut, Copy & Paste within 4D?
>
> Thanks,
>
> Robert
>
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **




-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Contextual Cut, Copy & Paste...?

2017-06-26 Thread Robert ListMail via 4D_Tech
This Windows-based client sees this as a glaring omission from modern software… 
I would expect it to work by default or easy to implement although I personally 
accepted the fact that I can’t right-click for a useful contextual menu at 
times. Tim, care to share how you implemented this for one of your clients?

Thanks,

Robert

> On Jun 22, 2017, at 5:29 PM, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> A client requested this feature. He’s a mouse nut. So I figured out a way to 
> easily implement it. He paid for it, he liked the end result. 

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Contextual Cut, Copy & Paste...?

2017-06-22 Thread David Adams via 4D_Tech
> I never use this feature. I, like you, use command keys for editing.

I use both. Does that make me a bad man?

There are plenty of very subtle disabilities/styles with cognition,
fine-motor skills, etc. that can make it *very* important people to have a
feature that makes no sense to us. If it's important to them and it's
possible, why not?

I actually use right-click to copy a lot in places that aren't editable.
For example, copying the data from a non-editable listbox. It's a hidden
feature, but once your'e away of it - it's great! (It's not built into 4D,
but lots of folks have added a contextual menu like this.)
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Contextual Cut, Copy & Paste...?

2017-06-22 Thread Tim Nevels via 4D_Tech
On Jun 22, 2017, at 5:20 PM, Chip Scheide wrote:

> given the amount of work (either coding, and/or clicking check boxes) 
> required -- of course unless you get to bill double for the time (once 
> for the work and once for it being stupid to have to do)
> 
> What is wrong with:
> Command/Cntrl + a
> Command/Cntrl + c
>  or
> Command/Cntrl + x
>  and
> Command/Cntrl + v
> ???

Nothing. I use it all the time. My preferred way to edit text. But other people 
do it other ways.

> Sorry if this sounds/seems harsh...but...
> any (employed) user who does not know & use these key stroke short cuts 
> needs to be:
> - re (or initially) trained
>or
> - released back to the wild

It sounds very harsh. An adult beverage might be in order for you at this exact 
point in time. :)

> IMHO there is NO excuse after 30+ years of desktop (personal) computing 
> to not know AT LEAST these 4 (plus Command/Cntrl + z) key short cuts.

Some people have only been doing computer for a few years. Not 30+ like you and 
me. 

Just responding to a “how to” post. It is a real “feature” that you can add to 
a 4D database. And a feature some people will use. Probably not many, but some 
will. 

A client requested this feature. He’s a mouse nut. So I figured out a way to 
easily implement it. He paid for it, he liked the end result. 

I never use this feature. I, like you, use command keys for editing. 

But some people are “mouse nuts” and they right click all over the place all 
the time. 

Tim


Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.com


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Contextual Cut, Copy & Paste...?

2017-06-22 Thread Chip Scheide via 4D_Tech
given the amount of work (either coding, and/or clicking check boxes) 
required -- of course unless you get to bill double for the time (once 
for the work and once for it being stupid to have to do)

What is wrong with:
Command/Cntrl + a
Command/Cntrl + c
  or
Command/Cntrl + x
  and
Command/Cntrl + v
???

Sorry if this sounds/seems harsh...but...
any (employed) user who does not know & use these key stroke short cuts 
needs to be:
- re (or initially) trained
or
- released back to the wild

IMHO there is NO excuse after 30+ years of desktop (personal) computing 
to not know AT LEAST these 4 (plus Command/Cntrl + z) key short cuts.

Chip

P.S. used Command/Cntrl + c on "Command/Cntrl + " and Command/Cntrl + v 
to insert plus the appropriate letter key.

On Thu, 22 Jun 2017 16:05:24 -0500, Tim Nevels via 4D_Tech wrote:
> On Jun 22, 2017, at 1:41 PM, Robert Broussard wrote:
> 
>> Is there a way to use the contextual menu of the host OS (Mac or 
>> Windows) for Cut, Copy & Paste within 4D?
> 
> It depends on the version of 4D that you are using for how much work 
> you need to do.  With v14+ there is a checkbox in the Property List 
> for fields and variables in the “Entry” area called “Context Menu”. 
> Check that option and you can right click in the field or variable 
> and get the Cut, Copy & Paste options. If the object is set to be 
> “Multi-style” you get even more options in the contextual menu.
> 
> But the “Context Menu” property is only available for text and string 
> fields or variables. Dates and numeric objects do not provide this 
> option so you must do it yourself with code.  Also if you are working 
> with a 4D version prior to v14 you have to do this for all field and 
> variable types.
> 
> First turn on the “Clicked” form event for the field or variable on 
> the form. Then add this method to the object method:  
> HandleContextualMenu.
> 
>   // ===
>   // PROJECT METHOD: HandleContextualMenu
> 
>   // PARAMETERS: $1 = menu ref (optional)
>   // $2 = method name (optional)
> 
>   // DESCRIPTION: Put this method in a form object and it will
>   // respond to a right-click in the current object. 
> 
>   // Pass no paramters and it will do the default which is to support
>   // Cut, Copy and Paste in the current object.
> 
>   // CREATED BY: Tim Nevels, Innovative Solutions ©2016
>   // DATE: 4/1/16
>   // LAST MODIFIED: 
>   // 
> 
> C_TEXT($1;$menuRef_t)
> C_TEXT($2;$methodName_t)
> If (Count parameters>=1)
>$menuRef_t:=$1
> Else 
>$menuRef_t:=<>defaultRightClickMenuRef_t
> End if 
> If (Count parameters>=2)
>$methodName_t:=$2
> End if 
> 
> C_TEXT($menuItem_t)
> C_LONGINT($mouseX;$mouseY;$mouseButton;$start;$end)
> 
> If (Form event=On Clicked)
>GET MOUSE($mouseX;$mouseY;$mouseButton)
>If (Macintosh control down | ($mouseButton=2))  // right-click
> // determine enabled/disabled for Cut and Copy items
>   GET HIGHLIGHT(Self->;$start;$end)
>   If (($end-$start)>0)
>  ENABLE MENU ITEM($menuRef_t;1)  // Cut
>  ENABLE MENU ITEM($menuRef_t;2)  // Copy
>   Else 
>  DISABLE MENU ITEM($menuRef_t;1)  // Cut
>  DISABLE MENU ITEM($menuRef_t;2)  // Copy
>   End if 
> 
> // determine enabled/disabled for Paste item
>   If (Get text from pasteboard="")
>  DISABLE MENU ITEM($menuRef_t;3)  // Paste
>   Else 
>  ENABLE MENU ITEM($menuRef_t;3)  // Paste
>   End if 
> 
> // display the menu
>   $menuItem_t:=Dynamic pop up menu($menuRef_t)
> 
> // handle the selected item
>   Case of 
>  : ($menuItem_t="")
>   // nothing selected
> 
>  : ($methodName_t#"")  // use custom method handler
> EXECUTE METHOD($methodName_t;*;$menuItem_t)
> 
>  : ($menuItem_t="Cut")  // handle default Cut operation
> POST KEY(Character code("x");Command key mask)
> 
>  : ($menuItem_t="Copy")  // handle default Copy operation
> POST KEY(Character code("c");Command key mask)
> 
>  : ($menuItem_t="Paste")  // handle default Paste operation
> POST KEY(Character code("v");Command key mask)
> 
>   End case 
>End if 
> End if 
> 
> I build the contextual menu On Startup for a little performance 
> optimization with this method:
> 
>   // ===
>   // PROJECT METHOD: CreateDefaultRightClickMenu
> 
>   // PARAMETERS: none
> 
>   // DESCRIPTION: Creates the default right-click menu with
>   // Cut, Copy and Paste
> 
>   // CREATED BY: Tim Nevels, Innovative Solutions ©2016
>   // DATE: 4/1/16
>   // LAST MODIFIED: 
>   // 
> 
> <>defaultRightClickMenuRef_t:=Create menu
> 
> APPEND MENU ITEM(<>defaultRightClickMenuRef_t;"Cut")
> SET MENU ITEM PARAMETER(<>defaultRightClickMenuRef_t;-1;"Cut")
> 
> APPEND MENU ITEM(<>defaultRightClickMenu

Re: Contextual Cut, Copy & Paste...?

2017-06-22 Thread Tim Nevels via 4D_Tech
On Jun 22, 2017, at 1:41 PM, Robert Broussard wrote:

> Is there a way to use the contextual menu of the host OS (Mac or Windows) for 
> Cut, Copy & Paste within 4D?

It depends on the version of 4D that you are using for how much work you need 
to do.  With v14+ there is a checkbox in the Property List for fields and 
variables in the “Entry” area called “Context Menu”. Check that option and you 
can right click in the field or variable and get the Cut, Copy & Paste options. 
If the object is set to be “Multi-style” you get even more options in the 
contextual menu.

But the “Context Menu” property is only available for text and string fields or 
variables. Dates and numeric objects do not provide this option so you must do 
it yourself with code.  Also if you are working with a 4D version prior to v14 
you have to do this for all field and variable types.

First turn on the “Clicked” form event for the field or variable on the form. 
Then add this method to the object method:  HandleContextualMenu.

  // ===
  // PROJECT METHOD: HandleContextualMenu

  // PARAMETERS: $1 = menu ref (optional)
  // $2 = method name (optional)

  // DESCRIPTION: Put this method in a form object and it will
  // respond to a right-click in the current object. 

  // Pass no paramters and it will do the default which is to support
  // Cut, Copy and Paste in the current object.

  // CREATED BY: Tim Nevels, Innovative Solutions ©2016
  // DATE: 4/1/16
  // LAST MODIFIED: 
  // 

C_TEXT($1;$menuRef_t)
C_TEXT($2;$methodName_t)
If (Count parameters>=1)
   $menuRef_t:=$1
Else 
   $menuRef_t:=<>defaultRightClickMenuRef_t
End if 
If (Count parameters>=2)
   $methodName_t:=$2
End if 

C_TEXT($menuItem_t)
C_LONGINT($mouseX;$mouseY;$mouseButton;$start;$end)

If (Form event=On Clicked)
   GET MOUSE($mouseX;$mouseY;$mouseButton)
   If (Macintosh control down | ($mouseButton=2))  // right-click
// determine enabled/disabled for Cut and Copy items
  GET HIGHLIGHT(Self->;$start;$end)
  If (($end-$start)>0)
 ENABLE MENU ITEM($menuRef_t;1)  // Cut
 ENABLE MENU ITEM($menuRef_t;2)  // Copy
  Else 
 DISABLE MENU ITEM($menuRef_t;1)  // Cut
 DISABLE MENU ITEM($menuRef_t;2)  // Copy
  End if 

// determine enabled/disabled for Paste item
  If (Get text from pasteboard="")
 DISABLE MENU ITEM($menuRef_t;3)  // Paste
  Else 
 ENABLE MENU ITEM($menuRef_t;3)  // Paste
  End if 

// display the menu
  $menuItem_t:=Dynamic pop up menu($menuRef_t)

// handle the selected item
  Case of 
 : ($menuItem_t="")
  // nothing selected

 : ($methodName_t#"")  // use custom method handler
EXECUTE METHOD($methodName_t;*;$menuItem_t)

 : ($menuItem_t="Cut")  // handle default Cut operation
POST KEY(Character code("x");Command key mask)

 : ($menuItem_t="Copy")  // handle default Copy operation
POST KEY(Character code("c");Command key mask)

 : ($menuItem_t="Paste")  // handle default Paste operation
POST KEY(Character code("v");Command key mask)

  End case 
   End if 
End if 

I build the contextual menu On Startup for a little performance optimization 
with this method:

  // ===
  // PROJECT METHOD: CreateDefaultRightClickMenu

  // PARAMETERS: none

  // DESCRIPTION: Creates the default right-click menu with
  // Cut, Copy and Paste

  // CREATED BY: Tim Nevels, Innovative Solutions ©2016
  // DATE: 4/1/16
  // LAST MODIFIED: 
  // 

<>defaultRightClickMenuRef_t:=Create menu

APPEND MENU ITEM(<>defaultRightClickMenuRef_t;"Cut")
SET MENU ITEM PARAMETER(<>defaultRightClickMenuRef_t;-1;"Cut")

APPEND MENU ITEM(<>defaultRightClickMenuRef_t;"Copy")
SET MENU ITEM PARAMETER(<>defaultRightClickMenuRef_t;-1;"Copy")

APPEND MENU ITEM(<>defaultRightClickMenuRef_t;"Paste")
SET MENU ITEM PARAMETER(<>defaultRightClickMenuRef_t;-1;"Paste")

All of this would be unnecessary if 4D would simply enable “Context Menu” 
property for field types other than text and string. But as of v16 they do not 
so you have to do this workaround.

Tim


Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.com


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Contextual Cut, Copy & Paste...?

2017-06-22 Thread Jeffrey Kain via 4D_Tech
Yes, if the text box is multi-style there's a checkbox in the property list to 
enable this.

--
Jeffrey Kain
jeffrey.k...@gmail.com


> On Jun 21, 2017, at 10:05 PM, Robert ListMail via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Is there a way to use the contextual menu of the host OS (Mac or Windows) for 
> Cut, Copy & Paste within 4D?
> 
> Thanks,
> 
> Robert

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Contextual Cut, Copy & Paste...?

2017-06-21 Thread Robert ListMail via 4D_Tech
Bump

Sent from my iPhone

> On Jun 21, 2017, at 9:05 PM, Robert ListMail via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Is there a way to use the contextual menu of the host OS (Mac or Windows) for 
> Cut, Copy & Paste within 4D?
> 
> Thanks,
> 
> Robert
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Contextual Cut, Copy & Paste...?

2017-06-21 Thread Robert ListMail via 4D_Tech
Is there a way to use the contextual menu of the host OS (Mac or Windows) for 
Cut, Copy & Paste within 4D?

Thanks,

Robert

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**