Exposing the ListPopulating Event of a SFListView in a custom user control


Author
Message
Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
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

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
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.

Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
Thanks Trent,  I am rapidly learning that this is a must more involved process.  I will search for some good articles about the topic.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
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. Wink

Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
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

Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
It Works!!!!!!w00t  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.BigGrin

Scott

Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Scott I personally find everyones questions and thoughts here invaluable. So thanks for that.



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



I just finished getting our .NET development environment the way I wanted it so I will start coding with Strataframe Monday.


Keith Chisarik
Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
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.
Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Same here I have dabbled in .NET on some projects, mostly small. I am about to jump in with both feet.



Good stuff.

Keith Chisarik
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Congrats Scott! Smile 

I was glad to hear that you got your fist event written.  Once you figure it out the first time, it is smooth sailing later on (at least smoother Hehe ).  Glad to hear to got it going!

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