Re: use-livecode Digest, Vol 159, Issue 30

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: use-livecode Digest, Vol 159, Issue 30

Quentin Long
sez hh:
> What you say is logically totally wrong.
Really. Did you read the sample code dunbarx posted? And if you read it, did you understand it? Please, inform me which rawKeyDown events a "do rawKeyDown" handler *will not* trap. As well, do clue me in to which rawKeyDown events will slip thru a "on rawKeyDown" handle which *does not* have a "pass rawKeyDown" statement in it.

> "DoScrollUpStuff" may of course easily be written such that Craig's
> script does the same as your script.
Of course. But it *wasn't explicitly written out*. And I was responding to *the sample code that was actually written*, as opposed to… say… making unsupported assumptions about *other* code that *could* have been written. Personally, I find that dealing with the code that's *actually there* tends to yield better results than dealing with code that I only *wish* was there. Your mileage may vary.

Is the problem that I didn't comprehend dunbarx's sample code… or is the problem that *you* hallucinated a statement or three which were not actually present in said sample code? Yes, "hallucinated" is not a particularly congenial word in this context, but it's no more offensive than your "logically totally wrong" phrase. As the saying goes, "you don't start none, there won't be none."

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
   
Read the webcomic at [ http://www.atarmslength.net ]!
   
If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
hh
Reply | Threaded
Open this post in threaded view
|

Re: use-livecode Digest, Vol 159, Issue 30

hh
Quentin L. wrote:
> Did you read the sample code dunbarx posted? And if you read it, did you
> understand it?

-- Here's the code we both have to understand:
on rawkeydown tkey
   if tkey = 65308 then doScrollDownStuff
   else doScrollUpStuff
end rawkeydown

The wording of your first post was as if Craig had make a silly beginner's
mistake with that. But it is you who made a mistake by concluding from the
naming of a handler to it's content:

Quentin L. wrote:
> "Hold it. That code, as written, will trap *A*L*L* rawKeyDown
> events, and silently kill everything that's *not* a scrollwheel-down
> event. Which, in turn, means that text input is toast, among other
> probably-unwanted side-effects."

That's logically totally wrong. If you are insulted by one of the words
"totally" or "logically" then I don't insist on that, strike out these
two words and I apologize. But it's still wrong.

Let me explain. Make a new stack with two fields (for output).

###### card's script
-- the code we both have to understand:
on rawkeydown tkey
   if tkey = 65308 then doScrollDownStuff
   else doScrollUpStuff
end rawkeydown

-- the code that shows your conclusion that the above code
-- "kills everything that is not scrollwheel-down event"
-- is wrong. You can type and 'blindtype' the example range into
-- fld 1 [doesn't respect non-english keymappings, but works].
on doScrollUpStuff
   put the keysdown into k; put item 1 of k into k0
   if 31 < k0 and k0 < 128 then --  handle an example range
      if 65505 is among the items of k then
         put upper(numTochar(k0)) after fld 1
      else put numTochar(k0) after fld 1
   else put "<"&k&">" after fld 1
   call "rawkeydown k" of this stack
end doScrollUpStuff

-- we have to use a workaround because our scrollup is broken.
-- click for example the wheel button (if any) and scroll down
-- to get a scroll up (65309)
on DoScrollDownStuff
   if mouse(2) is down then -- just as an example
      call "rawkeydown 65309" of this stack
   else call "rawkeydown 65308" of this stack
end DoScrollDownStuff

###### stack's script
on rawkeydown t
   put t into fld 2
   -- pass rawkeydown
end rawkeydown

Of course your switch code (= essentially the dictionary example)
is the script one should "usually" use. But that does not mean
that other script's as the first one above are wrong. So, your
conclusion is wrong. That's what I meant.

Don't mind. We all make mistakes. And what's wrong that's wrong.
No matter who wrote it, you or me ;-)


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode