Re: How to detect a key modifier during mouse click

Johan Brichau <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
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 <[email protected]> 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
> [email protected]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.