Powerbuilder Select rows with keyboard

Posted on 2011-04-20
Last Modified: 2013-12-26

I'm looking solution how to select rows without mouse, using keyShift!, keyDownArrow! and KeyUpArrow! With my code it selects all rows, but I need figured out how to select rows one by one. My code:

long row, ll_selectedrow, ll_rc

If KeyDown (KeyShift!) AND KeyDown (KeyDownArrow!) Then
ll_selectedrow = getselectedrow(0)  
IF ll_selectedrow = 0 THEN  
      Row = Long( dw_kst.Object.DataWindow.FirstRowOnPage )
      This.SelectRow(row, False)  
      IF row > ll_selectedrow THEN  
         FOR  ll_rc = ll_selectedrow TO row  
           This.SelectRow(ll_rc, True)  
         FOR ll_rc = row TO  ll_selectedrow
            This.SelectRow(ll_rc, True)  
      END IF  
   END IF         
Question by:merovingen
    LVL 14

    Accepted Solution

    It depends where you write the code and other code available to select and unselect row. In your code second for loop starts with zero and hence This.SelectRow(ll_rc, True) sets all rows selected.

    If I write a code in rowfocuschanged event it will be simple as below (assuming datawindow clicked event has code to select the clicked row)

    If KeyDown (KeyShift!) AND ( KeyDown (KeyDownArrow!) OR KeyDown(KeyUpArrow!)) Then
    End If


    Author Closing Comment

    Thank you very much. Solution was pretty helpful. I'm new in Powerbuilder and sometimes really hard for understanding where to write script.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
    This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now