Clicking on toolstrip from dirty Ultrawingrid cell causes cell to not save to BBS


Clicking on toolstrip from dirty Ultrawingrid cell causes cell to not...
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
I have an ultrawingrid in a groupbox.  If I am in a dirty cell, then click save, the changes to the current dirty cell are not saved.  As best I can tell this is because the buttons on the toolstrip do not actually get focus, so the lostfocus of the cell, grid, groupbox do not fire.

If I just put a button on the form and put Me.Save() in the click all is well and the dirty cell saves as shown.

So, I found the itemclicked event of the toolstrip and I can determine which button was clicked but setting focus to that button doesn't seem to be an option. 

Is there an elegant way to fire a focus() if the choice is Save so that the cell will save properly?  or should I just put my own save button over the save button on the toolbar (seems to come as a set with Undo) and then handle the enabling etc myself. ?

TIA

Charles
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
Charles, once again a particularly well explained and insightful question Tongue

It seems setting focus to the toolstrip itself is the trick

This is now in the MaintenanceformToolStrip_itemClicked() event

If e.ClickedItem.Name = "cmdSave" then
      Me.MaintenanceFormToolStrip1.Focus()
End If


and now it seems happy.  If I click Save directly from a dirty cell the changes shown in the cell are retained.

( now when I forget how this works I can Search on the forum Cool )
Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
LOL, this from the guy who teased me about talking to myself on the F1 forums.

I was going to say you could always subclass your form and create a writebuffer method that the save calls Smile
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
Thought you might get a kick out of that.

I was looking for something *really* simple.  Remembered that it was often necessary to not have a control get focus so you could escape from some field that wouldn't validate.  Still don't know how they keep a maintenance strip from getting focus by default and was frankly a bit surprised to see that calling it explicitly works but so far seems to be the answer.  ( and I really trust the guy who answered it ... )
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
That was great, Charles.

I do have a small invisible textbox on my base form that I always make visible, set focus and make invisible in its  BeforeSave method. That did the trick for me for all my forms.
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