Solved

infragistics Ultragrid

Posted on 2016-07-25
6
64 Views
Last Modified: 2016-07-27
Windows Forms app -

I want to set focus upon form activate to a infragistics Ultragrid.  I'm calling grid.focus() as the last line of code in form activate.    However, the grid does not have focus.   And I can't seem to determine where the focus is.     Hitting tab once will give the grid focus.  Is there anything odd about focus and the Ultragrid?  Do I also need to give focus to a row?
0
Comment
Question by:HLRosenberger
  • 4
  • 2
6 Comments
 
LVL 33

Expert Comment

by:sarabande
ID: 41729663
you may check the public property 'CanFocus' which seems to indicate whether the ultra grid can have the focus. it perhaps depends on whether the grid has editable cells.

if you want to select a row or cell rather than to setting the focus to the control, i found an answer at infragistic forum (http://www.infragistics.com/community/forums/t/31880.aspx):

The grid follows the current record of the data source to which it is bound by default, meaning you would just have to set the binding manager's Position property to the index of the record that you want to "select":

UltraGrid grid = this.ultraGrid;
BindingManagerBase bm = grid.BindingContext[grid.DataSource, grid.DataMember];
bm.Position = 0;

Note that you can also select and activate an UltraGridRow programmatically; set the UltraGrid.ActiveRow property to activate the row, and use the Rows property of the Selected object to select a row:

this.ultraGrid.ActiveRow = row;
this.ultraGrid.Selected.Rows.Add( row );

perhaps you have to set an active row in order to get the focus to the grid.

note the ultragrid also has property ActiveCell which could be set same as ActiveRow.

Sara
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 41729914
The grid does not have any editable cells.  However, I can give it focus just by clicking anywhere within the grid.   That's all I want to do in code - give it focus.
0
 
LVL 33

Accepted Solution

by:
sarabande earned 500 total points
ID: 41730666
I'm calling grid.focus() as the last line of code in form activate.    However, the grid does not have focus.  
this can happen if some other control of your form gets the focus later. normally it is the first control in your form which has windows style bit WS_TABSTOP enabled. you may try to set the focus later. to see whether setting focus works at all you may add a button to your form and call grid.focus(); when the button was clicked.

did you check whether grid.canfocus is true or false?

Sara
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 1

Author Comment

by:HLRosenberger
ID: 41731786
ah, grid.canfocus is false, right after I call  grid.Focus() in form.activated.   So, where should I call grid.Focus() ?  Isn't form.activated the last form event?
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 41731796
Ah, I moved grid.Focus to AfterLoad event.  that did the trick!  

Thanks!
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 41731797
Thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

13 Experts available now in Live!

Get 1:1 Help Now