Results 1 to 10 of 10

Thread: Multi select records i a dynamic cDbCJGrid/cDbCJGridPromptList

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6

    Default Re: Multi select records i a dynamic cDbCJGrid/cDbCJGridPromptList

    Thanks for that wonderfull post, but I have one little problem with this script. I would like to have alle checkboxes checked, when I run the program.
    I did that with the following amendments in the code:

    Code:
    Procedure OnSetCalculatedValue String  ByRef sValue                
        RowID[] rwSelected
        RowID rwCurrent
        Boolean bInitialize
        Integer iFoundItem iFileNumber
        Handle hDDO
        Forward Send OnSetCalculatedValue (&sValue)
        Get pbInitialRecords to bInitialize
        Get prwSelectedRecords to rwSelected
        Delegate Get Server to hDDO
        If (hDDO <> 0) Begin
            Get Main_File of hDDO to iFileNumber
            If (iFileNumber <> 0) Begin
                Move (GetRowID(iFileNumber)) to rwCurrent    
            End
        End
        Move (SearchArray(rwCurrent, rwSelected, Self, RefFunc(SearchSelectedRowId))) to iFoundItem
                    
        If (iFoundItem = -1 and bInitialize = False) Get CheckedStateToValue False to sValue
        Else Get CheckedStateToValue True to sValue 
    End_Procedure
    Code:
    Procedure OnSetFocus
        Forward Send OnSetFocus
                
        Set pbInitialRecords to False
    End_Procedure
    At first sight, it looks like it works:
    Click image for larger version. 

Name:	checkbox1.png 
Views:	181 
Size:	73.6 KB 
ID:	8680

    The problem now is, that I can uncheck each checkbox, by clicking on any column in the row.
    Click image for larger version. 

Name:	checkbox2.png 
Views:	173 
Size:	73.3 KB 
ID:	8681

    After I uncheck a checkbox by this way, I am only able to check/uncheck the checkbox, by clicking directly on it.
    What did I wrong?


    And if I am using this one, how do I call this procdure the right way?
    Quote Originally Posted by ivankaupa View Post
    Allan,

    Great class!

    I create my own subclass from your class adding two new methods: DoSelectAll and DoSelectNone:

    Code:
        Procedure DoSelect Boolean bSelect
            Boolean bDynamicOld
            Handle hoDataSource
            RowID[] rwSelectedRecords
            
            Delegate Get Dynamic_Update_State to bDynamicOld
            Delegate Set Dynamic_Update_State to False        
            
            If bSelect Begin
                Delegate Get phoDataSource to hoDataSource
                Send Reset of hoDataSource
                Send Clear of (Server(Self))
                Send Find of (Server(Self)) GT (Ordering(Server(Self)))
                While (Found)
                    Get CurrentRowId of (Server(Self)) to rwSelectedRecords[SizeOfArray(rwSelectedRecords)]
                    Send Find of (Server(Self)) GT (Ordering(Server(Self)))
                Loop
            End
            
            Set prwSelectedRecords to rwSelectedRecords
            
            // Reposicionando o primeiro registro
            Delegate Send MovetoFirstRow
            Delegate Set Dynamic_Update_State to bDynamicOld           
        End_Procedure // DoSelect
        
        Procedure DoSelectAll
            Send DoSelect True
        End_Procedure // DoSelectAll   
    
    
        Procedure DoSelectNone
            Send DoSelect False
        End_Procedure // DoSelectNone
    Regards,
    Ivan Kaupa
    Last edited by mac_hasi; 3-Mar-2015 at 03:36 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •