StrataFrame Forum

Synch ListView Control

http://forum.strataframe.net/Topic14966.aspx

By Greg McGuffey - 3/17/2008

This is a sample of how to use a list view to navigate through the records of a ListView and keep the ListView in synch with the BO. A SF ListView was subclassed to add the synching functionality. See the project for info on how it was done. The project uses the StrataFrameSample db.



Features:

- Fairly easy to setup.

- Handles adding, updating and deleting within the BO

- Selecting an item in the list navigates to that item in the BO.

- Navigation of the BO automatically updates selected item in the list.

- Filling the data table automatically updates the list and synchs it



Usage:

- Drop a BO on the form

- Drop this control on the form

- Setup the columns for the listview (normal SF procedure)

- Setup the Population list settings. The method must be CopyDataFrom using the business layer overload.

- Set the BO of the synch list control



These are the basics. The last step depends on how you will load the BO. In the sample, the BO is simply loaded when the form is loaded. In that case, have the list load when the form is loaded also and be sure the initialization priority of the list to be larger than the priority of the form (the BO needs to be loaded first).



If you load the BO manually, then the list should be loaded manually also. Whenever you load the BO, simply call the UpdateAndSynch() method of the list after loading.



I typically will call the SelectFirstListItem() method after the load in order to make sure that the first item in the list is selected. This could probably be built in, but isn't at this point.



As always, comments/suggestions/improvements are welcome and appreciated!



Greg
By Edhy Rijo - 3/17/2008

Greg McGuffey (03/17/2008)
As always, comments/suggestions/improvements are welcome and appreciated!

Greg

Greg, this is great!, just now I had the time to test this and was able to make it run without error the very first time, very simple and easier to use and it works as advertised.

Thanks a lot for sharing this with us.

P.S.

Trent, this will be a great enhancement to the framework, please try it.

By Greg McGuffey - 3/18/2008

Glad it helped and worked! BigGrin



If you think of or code any enhancements, please share BigGrin
By Trent L. Taylor - 3/18/2008

ListView now supports UI data interaction including related business objects, child form dialog, and related command or toolstrip buttons.

The ListView has been dramatically expanded to have native logic for tasks that are common recoded.  There are now many new properties (detailed below) and events that allow a more dynamic child display interaction with much less code.  By simply setting the UI interaction properties of the ListView, the ListView will dynamically manage the toolstrip buttons (or any other type of control) for the Add, Edit, and Delete as well as any security keys that may also be associated with those objects.  Additionally, a ChildFormDialog can be attached to the ListView which will then by dynamically shown to the end-user on an Add or Edit dynamically with no additional code.  Finally, the ListView will now allow the instance of the business object of which it represents to be attached and the current index (or row position) of the business object to be dynamically updated.

New Properties: 

AddObject
AddObjectSecurityKey
EditObject
EditObjectSecurityKey
DeleteObject
DeleteObjectSecurityKey
DeleteMessageKey
AutoNavigateToSelectedRecord
HandleAddAction
HandleDeleteAction
HandleEditAction

New Events: 

ChildFormResults

I will post the updated assemblies and a sample of how to use this new logic later this week.

By Edhy Rijo - 3/18/2008

GreatExclamation Mark

Thanks a lot.Tongue

By Greg McGuffey - 3/18/2008

Cool Trent! I look forward to checking it out!
By Edhy Rijo - 3/19/2008

Greg McGuffey (03/18/2008)
Cool Trent! I look forward to checking it out!

Hi Greg,

I made a change to the SynchListView class to handle the SaveUndo, so when the Undo is executed the listview will be re-synch.

All the code I added is commented with the following string:

' Edhy Rijo 03/19/2007:

By Greg McGuffey - 3/19/2008

Thanks Edhy! I'll check it out BigGrin
By Michael Reese - 3/25/2008

Sounds Great!

So does that mean we do not have the code the listview anymore? Will already coded listviews have the code removed? Is it still coming soon?

By Trent L. Taylor - 3/25/2008

So does that mean we do not have the code the listview anymore?

Pretty much...I have been using it for a week now and it has been working well.  I will post a sample and assemby pretty soon so you all can have it as well.

Will already coded listviews have the code removed?

No, they will work as they did before.  If you want to use the new logic you can, but all existing code will still work just fine.

Is it still coming soon?

Yup...very Wink

By Mike Tomlin - 4/16/2008

Soon? Smile
By Trent L. Taylor - 4/16/2008

Well, I could give it to you today but it doesn't have any docs, samples, etc.  So it would then require me to stop all other forward motion, such as some of the enhancement requests that have come up lately.  So it is all about priorities. Wink

I will be posting a beta build in the Posted Releases section later today that will have some new features that people have been waiting for, including this list, but I will not be posting any docs or samples along with the build.

By Trent L. Taylor - 4/16/2008

You can get the build that has this functionality here: http://forum.strataframe.net/FindPost15687.aspx
By Greg McGuffey - 4/16/2008

LOL, I tried to use the new properties on the Listview just yesterday and they didn't work. Now I know why! BigGrin New build looks very nice.
By Edhy Rijo - 4/16/2008

Hi Trent,

I installed the beta 1.6.5.1 and noticed that in the About window all dll are showing version 1.6.5.0 except for the .exe files, is this correct?

Please take a look at this image.

By Trent L. Taylor - 4/16/2008

No.  The files in your Common Files\MicroFour\StrataFrame folder did not get updated.  Here is a screen shot from one of our test machines, so I know that the install is working correctly (it at least contains the proper versions).

FYI...this is a screen shot from a 64-bit test machine since I am farily confident that you are on a 64-bit machine.  It is important that you were not in VS while installing, let the install finish, and then go back in as there were changes to the Extensibility assemblies to account for 64-bit machines.  Otherwise if could be reporting wrong.

By Edhy Rijo - 4/16/2008

These are the steps I used in the update:
  1. Close all instance of VS.
  2. Ran StrataFrameSetup.exe
    • This removed previous version which was installed in drive C:
    • I skipped the Database Installation since that was previously updated.
  3. Installation completed without any issues.

The setup put the updated libraries in this location:

C:\Program Files (x86)\Common Files\MicroFour\StrataFrame

For some reason the About form is looking at:

C:\Program Files\Common Files\MicroFour\StrataFrame

which had the old version of the libraries.

I will uninstall SF completely and make sure there is nothing else in these locations:

C:\Program Files (x86)\Common Files\MicroFour\StrataFrame

C:\Program Files\Common Files\MicroFour\StrataFrame

Then I will install it again and see what happen.  Will do that now....Hehe

By Edhy Rijo - 4/16/2008

Vista 64bits Installation steps:

  • Accepted Installation suggested forlder: C:\Program Files (x86)\MicroFour\StrataFrame

  • Got AddIn error, looking at the wrong folder: C:\Program Files\Common Files\MicroFour\StrataFrame\StrataFrame2008.AddIn

I remove SF again, and started the installation and modified the install folder to use: C:\Program Files\MicroFour\StrataFrame.

This time installation completed without errors, but when opening VS got this error message: "The Add-in StrataFrame Add-in Manager failed to load or caused an exception.

Of course all the Add in where installed at C:\Program Files (x86)\Common Files\MicroFour even though I did not select that folder, guess this is a feature of InstallAware since the installation is being done on a 64bit OS.

Notice that the folder C:\Program Files\Common Files\MicroFour\StrataFrame was created but with no files. Then I did the following:

  1. Copied all the information from C:\Program Files (x86)\Common Files\MicroFour\StrataFrame to  C:\Program Files\Common Files\MicroFour\StrataFrame
  2. Remove installation
  3. Re-install in  C:\Program Files (x86)\MicroFour\StrataFrame and then everything worked.

I know you have tested this under Vista 64, but I am just reporting what I am experiencing with the installation.

By Trent L. Taylor - 4/16/2008

Edhy,

I have tested, on many different 64-bit machines, and the install works fines.  You are probably dealing with permission issues or something along those lines.  I cannot reproduce every developers environment that uses StrataFrame, but we DO install on the following platforms prior to releasing an update (including a beta): Windows XP SP2, Windows Vista 32 Business, Windows Vista 64 Business, Windows Server 2003 R2, and now Windows Server 2008.

So I already know that the install works in a clean environment.  There were some issues prior to the 1.6.5 release when we made some changes for a 64-bit environment for VS2008.  But none of these issues exist.