Hello all,

I have extended the "grid" class so I can make my own, custom grid
that behaves in a different manner.  The only change I have made thus
far is to override the "_dokeydown" method (code listed below).  I
have it set up so that pressing arrow keys will do nothing if the
"shift" key is also pressed, but nevertheless my grid is still
responding to the arrow keys when "shift" is pressed down, and its
"select" method is still called.  How can I figure out what the heck
is responding to the shift-key combination and messing everything up
by calling the grid's "select" method?


Code (you can see that I am visually verifying when the shift key is
pressed down and thus everything should be skipped, and also that the
select method is being called anyway, via Debug.write methods; I have
also included my gridtext and gridrow override code below, so you can
see that they are not doing anything of consequence):

<library>
        <include href="supergridtext.lzx" />
        <include href="supergridrow.lzx" />
        <class name="supergrid" extends="grid">
                <attribute name="_columnclass" value="lz.supergridtext" 
when="always" />
                <attribute name="_rowclass" value="lz.supergridrow" 
when="always"/>

                <method name="_dokeydown" args="kc">
                <![CDATA[
                if ( !selectable ) return;

                /* handle arrow key navigation
                        37 = left arrow, 38 = up arrow
                        39 = right arrow, 40 = down arrow
                */

                if (kc == 38 || kc == 40) {
                        if (!lz.Keys.isKeyDown(["shift","control"])) {
                                var s = getSelection();
                                if (s == null) {
                                        s = 
content.rowparent.replicator.clones[0];
                                } else {
                                        if (this.multiselect) s = 
s.reverse()[0];
                                }
                                if (kc == 40) {
                                        _selector.getNextSubview(s).select();
                                }
                                if (kc == 38) {
                                        _selector.getNextSubview(s, 
-1).select();
                                }
                        }
                } else {
                        Debug.write("Shift is down!");
                }
                ]]>
                </method>
                <method name="select" args="item">
                        Debug.write("SELECT CALLED!");
                        super.select(item);
                </method>
        </class>
</library>

<library>
        <class name="supergridrow" extends="basegridrow">
        </class>
</library>

<library>
        <class name="supergridtext" extends="gridtext">
                <attribute name="editable" value="false" type="boolean"/>
        </class>
</library>

-- 
Justin Ellis
646-783-9387
Fax: 866-448-6503
[email protected]
www.LightBulbLaw.com

Reply via email to