Strataframe Listview Questions


Author
Message
Thomas Holste
Thomas Holste
StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

I did not give up and this is it what seems to work. I post it in case anyone else wants to use the

statalistview in unbound mode.



If e.KeyCode = Keys.Down Then

   Dim nPos As Integer

   Dim nLast As Integer

   Dim nNext As Integer

   ' Get number of items

   nLast = LV.Items.Count - 1

   ' Get index-position of selected item

   nPos = LV.Items.IndexOf(LV.SelectedItems(0))

   nNext = nPos + 1

   If nLast > -1 And nNext <= nLast Then

      ' Set index to next possible position

      LV.Items.Item(nNext).Selected = True

     ' Ensure that the display "moves" along the index-setting

      LV.EnsureVisible(LV.Items.Item(nNext))

   End If

End If



This is just a first version but it works. If anyone knows problems which could emerge with this kind of code, please tell me.

Best regards

Thomas
Thomas Holste
Thomas Holste
StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

I do not consider using the Listview control as it has not the display-possibilities of the stratalistview-control. What really attracts me is the ability of displaying header and footer text like it does and that's why I tried it and am still trying to use it. What I would like to know is, if it is planned to add keyboard-support for skipping through items or if that is not an issue for the near future? In that case I will have to try some other control for that app.

Best regards

Thomas
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hey Thomas.

It makes sense, but while that have you considered using the standard StrataFrame ListView?
Thomas Holste
Thomas Holste
StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Edhy,

thanks a lot for your tips which made things a bit clearer for me.

I hadn't realised that stratalistview is a beta-version, which explains to me why such a basic thing like keyboard navigation is not implemented. To implement some keyboard-handling like you suggested seems to be easy but I am getting to the point where I would like to wait for some answer from the SF-Team what seems to be the securest thing. Without knowing what direction the stratalistview might take it is a bit unsafe for me to work with a subclassed control which is in beta. And adding the keyboard-handling does not help me finding out how to navigate within the list. I will surely try a BO, but would definitely prefer to use it in unbound mode. But as this app is just a side-project, I will wait what the SF-Teams will say about keyboard-handling and index-based selecting an item.

Best regards

Thomas
Edhy Rijo
E
StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Thomas,

A quick look at the StrataListView source code reveals that they added code to handle the Key.Up/Down but the code in the OnKeyUp event is commented out, so either they had an issue with the code or something else.

With this information you can either subclass the StrataListView as I had done and try to implement the OnKeyUp and the ManageKeyStroke() method or just wait for the SF team response.

In case you have not found out yet, StrataListView is in the MicroFour StrataFrame UI Expanded project in the "Controls WinForm" folder.

Here is the commented code:

      /// <summary>
         /// Look for certain key combinations on the up
         /// </summary>
         /// <param name="e"></param>
         protected override void OnKeyUp(KeyEventArgs e)
         {
             base.OnKeyUp(e);
             //-- START HERE AGAIN FOR KEYBOARD IMPLEMENTATION
             ////-- Check for valid key strokes
             //if(e.KeyCode == Keys.Down ||
             //   e.KeyCode == Keys.Up)
             //{
             //    ManageKeystroke(e);
             //}
             //-- Reset the ctrl key
             _IsCtrlDown = false;
         }



Edhy Rijo

Edited 13 Years Ago by Edhy Rijo
Edhy Rijo
E
StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Thomas,
Like I said before, I cannot help you adding the functionality of Up/Down because I have not done that before, and I am not a member of the SF team.  All I know is that this control was released under beta and is not feature completed so only the SF team can provide a more direct answer of what features will this control be able to handle.

Now, knowing what what we know about the control, I would suggest the following:
  1. Look at the source code of the standard listview and see if the Up/Down feature is implemented and try to add that functionality to the StrataListView, if you have any issues, post the sample application here and we all can try to help out,  or
  2. Wait for somebody from the SF team to address this post, probably this functionality has already been implemented and not released.


Edhy Rijo

Thomas Holste
Thomas Holste
StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Edhy

thanks for your suggestions but I can not really understand what you mean by writing this:

<<  When you implement the Up/Down feature, the listview will keep track of the selected index which will be reported in the ListView.SelectedIndexChanged, just by using the code Ivan suggested will always get you the selected item in the list which you can identify in your BO or your table if you previously updated the .Tag property with the PK value you can later reference to your record.>>

Lets get a little bit more example like

1. I Add Items to a stratalistview and set an index-value in the tag-property of each item. If I have 10 items i start with 1 and finish with 10 ( or 0 to 9).

2. If I change the selected item I can get the value of the tag-property. This is what I understand from Ivans proposal.

This is all clear, but what do I have to do something like this:

1. Let's say the selected item tag is 1. The user wants to press the down-arrow-key to change the selected

item to the next item in the stratalistview (to simple skip through the item-list.

 To do this, as I understand it, there should be some code in

the keypress-event of the stratalistview (or form with key-preview) which handles the keypress in a way like that:

if keypressed = DownArrowkey

   ' what has to happen here to skip through the stratalistview?

Endif

Using a BO might be possible, but before I add an additional layer of complexity to a relative simple way of presenting data (No need to do anything than showing this data, which is not some kind of database but just plain ansi-data) I first would like to know what is possible and what not with the stratalistview. If it is clearly designed just to work with BOs, I accept this and would have to consider using a BO or using another tool for that specific task which would be a pity because of the wonderful visual appearance of the stratalistview with its possibilities of Header and footer subitems which is really useful for this special task.

Best regards

Thomas

 

 

 

 

 

 

 





 


Edhy Rijo
E
StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Thomas Holste (7/10/2011)
I already thought about that but how do I set an Index or to say it in other words how do I select a special item from outside the grid? For example: If I had to do the key-handling by myself, I would start on Position 1. Now a user presses the arrow-down key and I have to set the selected item to Position 2. Or presses PageDown and I would have to select the last position? How can I do this?


Hi Thomas,

If I understand you correctly, you really don't need to set any index for the selected item.  When you implement the Up/Down feature, the listview will keep track of the selected index which will be reported in the ListView.SelectedIndexChanged, just by using the code Ivan suggested will always get you the selected item in the list which you can identify in your BO or your table if you previously updated the .Tag property with the PK value you can later reference to your record.

Even thought you may consider overkill to use a BO, whatever you may loose may be worthy if it will make your development process and code easier.  BO are very useful to manipulate the data and unless you are dealing with many thousands of records, IMHO there is not a realistic penalty in performance.  I have applications that deals with thousands of records and a lot of data manipulations and the BO features like GetEnumerable, Filter, Seek, Navigate, CopyDataFrom just to mention a couple, makes my life easier with much less code than just using a native data table with twice or triple the code needed to handle the data manipulation.

At this point, if you still having issues with the StrataListView, I would suggest you post a basic sample where we can take a look and help you with the implementation you need.  Since I don't know when new updates will be released from the SF team, I even went ahead and added some functionality from the old listview by simply looking at its source code and implement some of them in the new one, nothing perfect but at least workable for my project until new updates are available, you can find the post here: http://forum.strataframe.net/FindPost28459.aspx


Edhy Rijo

Thomas Holste
Thomas Holste
StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)StrataFrame User (356 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

thanks for your answers

<<The standard StrataFrame listview will let you use the arrow keys for navigation. Up to now I hadn't noticed the StrataListView wouldn't.>>

It would be good and save me some time to definitely know, if the stratalistview supports the arrow-keys (and something might be wrong here) or not. And if not, if this will be implemented in the near future.

<<And for the selected value, you could use the listview "Tag" to store any value you want to fetch later, and then on the ListView.SelectedIndexChanged method and test on your ListView.SelectedItems(0).Tag value.  >>

I already thought about that but how do I set an Index or to say it in other words how do I select a special item from outside the grid? For example: If I had to do the key-handling by myself, I would start on Position 1. Now a user presses the arrow-down key and I have to set the selected item to Position 2. Or presses PageDown and I would have to select the last position? How can I do this?

Thanks in Advance and best regards

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

The standard StrataFrame listview will let you use the arrow keys for navigation. Up to now I hadn't noticed the StrataListView wouldn't.

And for the selected value, you could use the listview "Tag" to store any value you want to fetch later, and then on the ListView.SelectedIndexChanged method and test on your ListView.SelectedItems(0).Tag value. 
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