How to detect a key modifier during mouse click

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to detect a key modifier during mouse click

Dave
Hi guys,
Is there a Seaside way to detect if a key modifier is pressed during a mouse click event?

i.e. with standard jquery I can code something like:
$(#myDiv).click(function (e) {
    if (e.keyCode == 18) {
        alert("ALT was pressed");
    }
     else ...
});

but I can't imagine how to do the same on Smalltalk
html div onClick: ????

Can you help me please?
TIA
Dave
Reply | Threaded
Open this post in threaded view
|

Re: How to detect a key modifier during mouse click

Dave
The code from previous email wasn't visible, so I repost the email again:
-------
Hi guys,
Is there a Seaside way to detect if a key modifier is pressed during a mouse click event?

i.e. with standard jquery I can code something like:
$(#myDiv).click(function (e) {
    if (e.keyCode == 18) {
        alert("ALT was pressed");
    }
     else ...
});

but I can't imagine how to do the same on Smalltalk
html div onClick: ????

Can you help me please?
TIA
Dave
Reply | Threaded
Open this post in threaded view
|

Re: How to detect a key modifier during mouse click

Dave
Nobody?
Reply | Threaded
Open this post in threaded view
|

Re: How to detect a key modifier during mouse click

Stephan Eggermont-3
On 12-11-15 16:28, Dave wrote:
> Nobody?

World-wide list, and #Smalltalks2015 just started.

Stephan


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to detect a key modifier during mouse click

Johan Brichau-2
In reply to this post by Dave
Dave,

Not sure what exactly is the question. Here is what pops to my mind:

html div
        script: (html jQuery this on: 'click' do: ((JSStream on: 'if(e.keyCode === 18) … ‘) asFunction: #(e)))

Seaside’s Javascript generation feature is focused on generating wrapper code around Seaside-generated JQuery callbacks, etc.. so you can easily tie those together with your Javascript code.
If you’re looking to add (jQuery) ajax callbacks in your JS code, here’s an example:

html div
        script: (html jQuery this on: 'click' do: (((JSStream on: 'e.keyCode === 18') then: (html jQuery ajax callback:[ … ])) asFunction: #(e)))

If you need the keyCode to be transported to the server:

html div
        script: (html jQuery this on: 'click' do: ((html jQuery ajax callback:[:keyCode | ... ] value: ((html javascript alias:'e') access: 'keyCode')) asFunction: #(e)))

And there’s many more possibilities.
In general, I think you need to do as much as possible in hand-written Javascript and use Seaside-Javascript to glue server-side Smalltalk callbacks to your client-side Javascript code.

cheers
Johan


> On 12 Nov 2015, at 12:30, Dave <[hidden email]> wrote:
>
> The code from previous email wasn't visible, so I repost the email again:
> -------
> Hi guys,
> Is there a Seaside way to detect if a key modifier is pressed during a mouse
> click event?
>
> i.e. with standard jquery I can code something like:
> $(#myDiv).click(function (e) {
>    if (e.keyCode == 18) {
>        alert("ALT was pressed");
>    }
>     else ...
> });
>
> but I can't imagine how to do the same on Smalltalk
> html div onClick: ????
>
> Can you help me please?
> TIA
> Dave
>
>
>
> --
> View this message in context: http://forum.world.st/How-to-detect-a-key-modifier-during-mouse-click-tp4860663p4860664.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to detect a key modifier during mouse click

Dave
Johan Brichau-2 wrote
Dave,

Not sure what exactly is the question. Here is what pops to my mind:

html div
        script: (html jQuery this on: 'click' do: ((JSStream on: 'if(e.keyCode === 18) … ‘) asFunction: #(e)))
Thanks Johan,
That solves my question.

Dave