StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Exposing the ListPopulating Event of a...Expand / Collapse
Author
Message
Posted 08/17/2006 12:08:14 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 02/04/2008 8:43:02 AM
Posts: 176, Visits: 1,519
Sorry to ask so many simple questions but that .Net light bulb is still dim for me.  I am trying to create a user control and contains a listview and sever command buttons,  what I want to do is expose the SFListView events so that I can code directly on the new user control. (The next step would be to generate my own events).

Thanks again for all the .Net help.

Scott

Post #2232
Posted 08/17/2006 12:54:17 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:58:13 AM
Posts: 4,379, Visits: 4,421
The only way to "expose" the SF ListView events is by capturing them within your control and then raising your own events on the user control.  So first, you need to create events within your user control.  You will more than likely want to make these thread safe by testing to see if an Invoke is required to prevent cross-thread violations.

If your control does not have a .Invoke() method, then you will need to create a property and implement the ISynchonizeInvoke interface which will allow you to capture the parent control and us it's .Invoke() methods and properties.

Once you declare the events, you will need to create a delegate that can be called within the Invoke method which raises the exposed events.

Once you have your events declared, simply add a handler to capture the desired SF ListView events and then raise your events passing along any event arguments that you need.

Sorry if this is a little ambigous, but if you have not created events before this is a relatively large topic.

Post #2233
Posted 08/17/2006 1:19:17 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 02/04/2008 8:43:02 AM
Posts: 176, Visits: 1,519
Thanks Trent,  I am rapidly learning that this is a must more involved process.  I will search for some good articles about the topic.
Post #2236
Posted 08/17/2006 1:21:51 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:58:13 AM
Posts: 4,379, Visits: 4,421
Let me give you an idea on starting with events.  Create a new test project and create a new control within that project.  Create a simple event that has no event arguments.  Expose a method that will allow you to raise the event once dropped on a form.  You can then build from there. 

My point is, start very simple by just defining an event and then you can grow from there.

Post #2237
Posted 08/17/2006 8:35:57 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 02/04/2008 8:43:02 AM
Posts: 176, Visits: 1,519
After a long day of working with events I think I finally understand how this works.  I have done what you suggested but still don't seem to be getting the ListPopulating event fired.  In my class I have tied the ListPopulating event to a private method and it never seems to be getting called (I put a break point and execution never stops).

I know this isn't an easy one to solve via a simple post on a message board but if you have any suggestion as to what to check or look for I would be greatful.

PS other then this issue everything (other events for this control) is working perfectly. For others out there reading this tread here are the links that really helped me get a grip on events\delegates:

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=18
http://www.akadia.com/services/dotnet_user_controls.html

Post #2260
Posted 08/17/2006 9:00:27 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 02/04/2008 8:43:02 AM
Posts: 176, Visits: 1,519
It Works!!!!!!  I was making a stupid mistake,  the Fill method I was using didn't require any parameters, once I change the fill method to one that did, everything worked.

Thanks for your help. That .Net light buld is getting a little brighter.

Scott

Post #2261
Posted 08/17/2006 10:40:22 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 4:48:06 PM
Posts: 622, Visits: 19,106
Scott I personally find everyones questions and thoughts here invaluable. So thanks for that.

As for the dim bulb, wait another few days.....

I just finished getting our .NET development environment the way I wanted it so I will start coding with Strataframe Monday.
Post #2262
Posted 08/17/2006 11:20:33 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 02/04/2008 8:43:02 AM
Posts: 176, Visits: 1,519
Thanks for the support.  I am coming from a VFP background and .NET is a LOT to get your head wrapped around.  Thank God for SF, it takes care of a lot of the "details" and lets me worry about writing the application specific stuff.  As far as .NET goes,  I am liking it more and more every day, its just hard going from using a development language for about 15 years to being a "newbie". Everyone here is VERY supportive and I have learned a lot.
Post #2264
Posted 08/17/2006 11:34:42 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 4:48:06 PM
Posts: 622, Visits: 19,106
Same here I have dabbled in .NET on some projects, mostly small. I am about to jump in with both feet.

Good stuff.
Post #2265