How to disable the "mouse down" event 
Author Message
 How to disable the "mouse down" event

Due to problems I've described in a precedent message, I would like to know
how to temporarily disable the "mouse down" event.

I found in "Inside Macintosh" a function: "SetEventMask". But I didn't
succeed in understanding how to you use it (maybe because I don't speak

  Declare Sub SetEventMask Lib "InterfaceLib" (value as Short)

  Const mDownMask=2

code...

    SetEventMask mDownMask

But it doesn't work.

Please help me.



Sat, 25 Sep 2004 00:41:24 GMT  
 How to disable the "mouse down" event

Quote:

> Due to problems I've described in a precedent message, I would like to know
> how to temporarily disable the "mouse down" event.

You mean in your own program, or on the whole computer in general?

If you mean on the computer in general, you can't, at least not in
REALbasic.  Under Classic you could do this with some C and assembly
language using a jGNEFilter to filter all events before the OS does
anything else with them.  (I've been told my someone at RS that
jGNEFilters probably wouldn't be doable in a plugin.)  Under OS X, I
don't believe there is a way to do this, though I could be wrong.

If you mean in your program, well, you can't really do that either, not
totally.  No matter what you do, the user will still be able to click
in the menu, on window titles, etc.  Of course, you can screen out
clicks in your app's windows if you like.

BTW, why do you wish to do this?  It's really not a very good idea
unless you have a VERY good and VERY specific purpose.  It'd confuse
the user.



Sat, 25 Sep 2004 02:00:27 GMT  
 How to disable the "mouse down" event

Quote:

> Socit?: EarthLink Inc. -- http://www.EarthLink.net
> Groupes?: comp.lang.basic.realbasic
> Date?: Mon, 08 Apr 2002 18:00:27 GMT
> Objet?: Re: How to disable the "mouse down" event



>> Due to problems I've described in a precedent message, I would like to know
>> how to temporarily disable the "mouse down" event.

> You mean in your own program, or on the whole computer in general?

> If you mean on the computer in general, you can't, at least not in
> REALbasic.  Under Classic you could do this with some C and assembly
> language using a jGNEFilter to filter all events before the OS does
> anything else with them.  (I've been told my someone at RS that
> jGNEFilters probably wouldn't be doable in a plugin.)  Under OS X, I
> don't believe there is a way to do this, though I could be wrong.

No, just in my own app.

Quote:

> If you mean in your program, well, you can't really do that either, not
> totally.  No matter what you do, the user will still be able to click
> in the menu, on window titles, etc.  Of course, you can screen out
> clicks in your app's windows if you like.

I don't want the user to be able to click on other cells of my listbox, on
buttons or on "reorganize the order of rows" of my listbox button until the
text of the cell he is editing is 4 caracters in length.

What does "screen out" mean? I'm French and I don't speak English very well.

Quote:
> BTW, why do you wish to do this?  It's really not a very good idea
> unless you have a VERY good and VERY specific purpose.  It'd confuse
> the user.

Read the messages entitled "[Re: ]How to short-circuit an event", and
particularly the last, to know the whole story. In fact, I have a listbox
with 3 columns which 2 of them are editable. I would like the text of their
cells to be exactly 4 caracters in length after the user edited it (not
less, not more).


Sat, 25 Sep 2004 03:31:02 GMT  
 How to disable the "mouse down" event

Quote:

> I don't want the user to be able to click on other cells of my listbox, on
> buttons or on "reorganize the order of rows" of my listbox button until the
> text of the cell he is editing is 4 caracters in length.

You can filter events using the EventMonitor class in my plugin.

See:
<http://www.monkeybreadsoftware.de/realbasic/plugins.html>

There are some examples included.

mfg
Christian

--
PLZ Suche
Das einzige Postleitzahlensuchprogramm fr Mac OS X

Download unter <http://plz.macsw.de>



Sat, 25 Sep 2004 04:32:18 GMT  
 How to disable the "mouse down" event

Quote:

> I have a listbox
> with 3 columns which 2 of them are editable. I would like the text of their
> cells to be exactly 4 caracters in length after the user edited it (not
> less, not more).

Ahh, well that doesn't involve any disabling of mouse down events or
anything.

Here's one way.  First, add properties r and c to your window.  Next,
put a Timer in your window with a period of 200 and mode of 0 (off).
In it's Action event put the following code:

  ListBox1.EditCell r,c

Last, put the following code in your ListBox's CellAction event (which
gets called when the user exits an editable cell):

  if len(me.Cell(row, column)) <> 4 then
    beep
    r = row
    c = column
    Timer1.mode = 1
  end if

Voila!  Sure would be easier, though, if there was a way to do this
that didn't involve a Timer.

Also, if you want a more reusable, self-contained solution, create a
Timer subclass and then have your ListBox create a new instance of this
Timer subclass and link the two of them together somehow.



Sun, 26 Sep 2004 02:02:16 GMT  
 How to disable the "mouse down" event

Quote:

> Socit?: EarthLink Inc. -- http://www.EarthLink.net
> Groupes?: comp.lang.basic.realbasic
> Date?: Tue, 09 Apr 2002 18:02:16 GMT
> Objet?: Re: How to disable the "mouse down" event



>> I have a listbox
>> with 3 columns which 2 of them are editable. I would like the text of their
>> cells to be exactly 4 caracters in length after the user edited it (not
>> less, not more).

> Ahh, well that doesn't involve any disabling of mouse down events or
> anything.

> Here's one way.  First, add properties r and c to your window.  Next,
> put a Timer in your window with a period of 200 and mode of 0 (off).
> In it's Action event put the following code:

> ListBox1.EditCell r,c

> Last, put the following code in your ListBox's CellAction event (which
> gets called when the user exits an editable cell):

> if len(me.Cell(row, column)) <> 4 then
> beep
> r = row
> c = column
> Timer1.mode = 1
> end if

> Voila!  Sure would be easier, though, if there was a way to do this
> that didn't involve a Timer.

> Also, if you want a more reusable, self-contained solution, create a
> Timer subclass and then have your ListBox create a new instance of this
> Timer subclass and link the two of them together somehow.

Thanks, but I recently found my mistake: I used the "change" event instead
of using the "cellclick" event. The cellclick event is very interesting
because if it return "true", "the event will not be processed further
(editable cells won't be editable and Listbox selection won't change)". I
didn't read the language reference enough carefully. Excuse me.

I can give you the code I used, if you want.

Thanks for all.



Sun, 26 Sep 2004 05:05:02 GMT  
 How to disable the "mouse down" event

Quote:

> Thanks, but I recently found my mistake: I used the "change" event instead
> of using the "cellclick" event.

Maybe I'm missing something, but how does the CellClick event help?
AFAIK, there's no way to determine which cell is being edited.  You can
find out which row is selected, but not which column (again, AFAIK).
You can look at the ActiveCell property, but that is present and
contains an empty string even when there's no selection, so that won't
help either.  And the row and column passed to CellClick are the coords
of the cell clicked, not the one being edited.

I'd be interested to see the code you're using.



Mon, 27 Sep 2004 00:09:56 GMT  
 How to disable the "mouse down" event

Quote:

> Socit?: EarthLink Inc. -- http://www.EarthLink.net
> Groupes?: comp.lang.basic.realbasic
> Date?: Wed, 10 Apr 2002 16:09:56 GMT
> Objet?: Re: How to disable the "mouse down" event



>> Thanks, but I recently found my mistake: I used the "change" event instead
>> of using the "cellclick" event.

> Maybe I'm missing something, but how does the CellClick event help?
> AFAIK, there's no way to determine which cell is being edited.  You can
> find out which row is selected, but not which column (again, AFAIK).
> You can look at the ActiveCell property, but that is present and
> contains an empty string even when there's no selection, so that won't
> help either.  And the row and column passed to CellClick are the coords
> of the cell clicked, not the one being edited.

> I'd be interested to see the code you're using.

In a first time, I used the "CellLostFocus" event to know which cell lost
the focus and save those parameters:

  if len(listBox1.cell(row,column))<4 then
    beep
    erreur=true //"erreur" is a property (boolean). To know if there is an
error
    colonne=column //"colonne" and "ligne" are properties (integers).
    ligne=row
  end if

After that, I used the "CellClick" and the "SortColumn" (<- if the user sort
a column, the cell he is editing lose the focus) events:

  if erreur=true then
    listBox1.editCell(ligne,colonne) //reactive the cell which lost the
focus if there is an error
    listBox1.activeCell.selstart=len(listBox1.activeCell.text) //put the
cursor to the end
    erreur=false //reinitialisation of "erreur"
    return true //to not process further the event
  end if

I used the "CellTextChange" event, too, to limit the length of the text to 4
caracters:

listbox1.activeCell.limitText=4

That's all.



Mon, 27 Sep 2004 19:02:27 GMT  
 How to disable the "mouse down" event

Quote:

> I used the "CellLostFocus" event to know which cell lost
> the focus and save those parameters

Ahh, that makes sense.  Looks like a good solution!


Tue, 28 Sep 2004 01:35:17 GMT  
 How to disable the "mouse down" event
hmm there's got to be something with the focus you can do like
everytime a new is chose have it set a property and then when the next
new cell is chosen,  have it set the focus back to  the property if the
property is not 4 chars long (sorry it's all so vauge but i don't have
*hey matt* realbasic: the definitive guide to look it up quickly)


Sat, 02 Oct 2004 04:46:33 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. problems with "bind"ing mouse event

2. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

3. Disabling "send"

4. VisualWorks: disable _without_ "graying-out"

5. Windows "Abort" button - how to disable

6. Disabling image save "snapshot" sound

7. Disabling "X" exit button on toplevels

8. button gets stuck "down"

9. SHUT DOWN A "WINDOW"

10. "Down with Lambda Lifting"?

11. "Legacy Systems"--down with that term!

12. Send Program "Down for Maintenance"

 

 
Powered by phpBB® Forum Software