Keypress (down and up), mouse move, and mouse locking

jonathan3jonathan3 Posts: 0

Does anyone know how to do either of these functions in Daz script:

Detecting:
Key Down
Key Up
Mouse Movement

Overriding:
Mouse Locking (into the center)


Where could I find out info like this? The documentation is VERY limited, and the most info I get is from examining other scripts on some of the sites out there.

Comments

  • Richard HaseltineRichard Haseltine Posts: 33,925
    edited December 1969

    Mouse movement isn't available to scripting - it would need a new plugin, which could then make the data available to scripts, but I don't think there's anything currently available. I'm not sure if it's possible to capture key-presses - I was thinking a text edit box might do the job, as a workaround, but it doesn't look like it.

  • jonathan3jonathan3 Posts: 0
    edited December 1969

    Thanks to "Casual" for this:

    ed = new DzLineEdit( wDlg );
    connect( ed, "textChanged(const QString&)", textChanged );

    function textChanged( s )
    {
    if( s.length > 0 )
    {
    ed.text = "";
    switch(s.charAt(0))
    {
    case '1': bf1(); break;
    case '2': bf2(); break;
    case '3': bf3(); break;
    case '4': bf4(); break;
    case '5': bf5(); break;
    case '6': bf6(); break;
    case '7': bf7(); break;
    case '8': bf8(); break;
    case '9': bf9(); break;
    }
    }
    }

  • YudinedYudined Posts: 60

    I think it is interesting to realize in DzListView (in DzListBox too).

    Signals - "mouseButtonPressed(int,DzListViewItem*,const QPoint&,int)"   or  "mouseButtonClicked(int,DzListViewItem*,const QPoint&,int)"

    var Dlg = new DzDialog();
    LV = new DzListView( Dlg );
    LV.minWidth = 500;
    LV.minHeight = 500;
    connect(LV,"mouseButtonPressed(int,DzListViewItem*,const QPoint&,int)" , mouseClicked );
    Dlg.exec()
    
    function mouseClicked (button, item, pos, col)
    {
    		if( button == 1) print("left button")		
    		if( button == 2) print("right button")
    		if (button==4) print ("mid button")
            print ("y-"+ pos.y,"x-"+ pos.x)//  where is cursor? 
    }

    You can try signals for your actions :

    "doubleClicked(DzListViewItem*,const QPoint&,int)" 

    "rightButtonClicked(DzListViewItem*,const QPoint&,int)"

Sign In or Register to comment.