[Seaside] How to detect a key modifier during mouse click

Johan Brichau johan at inceptive.be
Thu Nov 12 18:48:22 UTC 2015


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.


> On 12 Nov 2015, at 12:30, Dave <lasmiste at gmail.com> 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
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

More information about the seaside mailing list