Ultragrid - ctrl-TAB won't work out of UG in groupbox when on TabPage


Author
Message
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
Actually we got it working BigGrin



It turns out my code to override the tabcontrol and to set focus coming out of the groupbox was the right thing.



But your baseform code in ProcessCmdKey was what was actually making it leave the grid. That is the right place to put it ( though it still seems to have the problem of not knowing where to go next )



I took out your baseform code and it stopped working. Put it back in, took out my Ultragrid onkeydown code for the navigation and it still works.



Oh, and I subclassed groupbox to call me.controls(0).focus() on Enter to be used where it just contains a grid. Created a property NextControl ( string ) and am trying to figure out how to say, in the Leave of the groupbox class "Set focus to the control named NextControl"



Here's the latest



Attachments
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Charles is like a kid in a candy store..... w00t
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Greg McGuffey (06/02/2010)
Charles is like a kid in a candy store..... w00t


That is a common effect from SF Hehe

Edhy Rijo

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
By the way, since we are in this UltraGrid marathon, have you been dealing with date columns on the grids? I am going nuts trying to duplicate the DateTimePicker behavior where 1/1/1800 should show empty date and entering empty date should save 1/1/1800 to the table.
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
I only have one data field in my grid which defaults to now() so I didn't realize it was a problem until you mention it and I try to blank the date.



I just tried using an SF wrapper UltraDateTimePicker as an editor component and at least the error message is different. When I blank the field in the grid I get an error that i have violated the minimum on the datetimeconstraint and the date is set to 01/01/0001



I think modifying an editorcomponent is going to be the way to go, but haven't worked it out yet. Perhaps modifying the SF picker control to implement that interface Infragistics says is necessary to use a control in an Ultragrid ? Or just using a straight winforms datetime picker and implementing that interface as well as the logic that SF uses to blank dates on null?
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Yep, guess we have this ahead of us. Ermm

The SF wrapper UltraDateTimePicker works just fine on itself, but when we set it to be the column editor, no luck.

Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
I have not been able to figure out where to intervene to translate the null in the control to #1/1/1800# in the BBS.



There is a BeforeRowUpdate and AfterRowUpdate and I can test for e.row.cells("DateofSale").value and there is a .setvalue method but I don't see how to change the data coming from the BBS to a null if it is #1/1/1800# and to change it back on the update.



I don't have source, so I'm poking around in the dark. Have a question up on StackOverflow but didn't have any luck there on my last Ultragrid question. The tech support guy on the Infragistics forum really doesn't seem to have his heart in it and doesn't answer questions very well. A couple of people have asked questions like this and his answers have not been helpful.



Anybody know if DevExpress grid has this problem? I have their trial right now and considering switching over.



Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
I was dealing with other things around here, back to the matter. I have also posted your question in the Experts Exchange forum and will get back to it now. The first to accomplish this gives a shout! BigGrin
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
I seems the question we really need to ask is : How do we display the date #1/1/1800# as if it were null. And how do we save null to the datasource/bbs as #1/1/1800#



The answers people seem to give seem to always start with telling you you can't have null dates in .NET ( which we know ) but they don't know about our framework's handling nulls as #1/1/1800# Sad

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Charles.

I think I found a way to handle this, not sure you will like it, but it seems to be working.

The idea is to add an unbound column to you grid, you can do that with the grid designer clicking on the "Add Unbound Column" button at the Columns treeview item. Give it a Key name, like ubc_Date. Set its DataType to System.DateTime. We will use this unbound column to store your date from the table. Have a look at the code and let me know.

#Region "  Private Fields  "

    '-- keep current cell state
    Dim _CellUpdating As Boolean = False

#End Region

#Region "  Handled Events  "

    Private Sub grdYourGrid_InitializeRow(ByVal sender As Object, _
                                          ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) _
                                          Handles grdYourGrid.InitializeRow
        '-- check if there are rows to be initialized
        If Me.grdYourGrid.Rows.Count() = 0 Then
            Exit Sub
        End If

        '-- move record point to current row
        YourTableBO1.SeekToPrimaryKey(e.Row.Cells("yt_pk").Value)

        '-- if cell is updating, don't set unbound column
        If _CellUpdating = False Then
            '-- if underlying table has #1/1/1800#, show empty cell for date
            If YourTableBO1.yt_Date = #1/1/1800# Then
                e.Row.Cells("ubc_Date").Value = DBNull.Value
            Else
                e.Row.Cells("ubc_Date").Value = YourTableBO1.yt_Date
            End If
        End If

        '-- reset the flag
        _CellUpdating = False
    End Sub

    Private Sub grdYourGrid_AfterCellUpdate(ByVal sender As Object, _
                                            ByVal e As Infragistics.Win.UltraWinGrid.CellEventArgs) _
                                            Handles grdYourGrid.AfterCellUpdate
        '-- if unbound date column, deal with empty date
        If e.Cell.Column.Key = "ubc_Date" Then
            If e.Cell.Value Is DBNull.Value Then
                YourTableBO1.yt_Date = #1/1/1800#
            Else
                YourTableBO1.yt_Date = CDate(e.Cell.Value)
            End If
        End If

        '-- set the cell state to updating
        _CellUpdating = True
    End Sub

#End Region


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search