ControlEvents library

Discussion in 'Additional Libraries' started by agraham, Oct 4, 2007.

  1. agraham

    agraham Expert Licensed User

    There are some events "missing" from the built-in controls in B4PPC. This library enables them to be used if anyone so wants. The included help file gives details.


    This library is built for .NET 2.0 as I cannot target .NET 1.1 or CF 1.0. However I have included the source in the zip so maybe some kind person can recompile it for .NET 1.1 and repost it as (say) ControlEvents1.dll so that anyone who want to use doesn't need .NET 2.0.
     

    Attached Files:

  2. dzt

    dzt Active Member Licensed User

    :sign0098:

    I'm a kind person too, but it seems not so fast person :)
     
  3. agraham

    agraham Expert Licensed User

    Thanks guys.:sign0098:
     
  4. agraham

    agraham Expert Licensed User

    It may not be obvious but you can add the events in this library to the controls in the ControlEx library although it may not be useful or work for some of them. For example - A TrackBar

    Code:
    ' assuming a ControlEvents Object called TrkBrEvents
    ' and a TrackBar object called TrkBr

    Sub App_Start
       Form1.Show
       TrkBr.New1(
    "Form1",10,10,100,30,false' new TrackBar Control
       TrkBrEvents.New1(TrkBr.ControlRef)      ' add the new events
    End Sub

    Sub TrkBrEvents_GotFocus
       
    ' do something 
    End Sub
    You can also add the events to controls added at runtime by just specifying their name -
    Code:
    AddButton("Form1","RunTimeButton",10,10,60,30,"ClickMe"
       BtnEvents.New1(
    "RunTimeButton")
     
  5. agraham

    agraham Expert Licensed User

    Apologies if anyone saw this post come and (rapidly) go a bit earlier. I posted a zip that had the wrong help file. Helpmaker may be free but it is also very idiosyncratic and it seems to be easy to get it confused in several different ways - I ended up reposting the original help. Hopefully all is well this time.

    Second and final (hopefully) version of the library with modified help and source. Again compiled for .NET 2.0 - dzt's opportunity to get in fast!

    The Key events have been added so this, together with the built-in events in B4PPC, gives access to just about all the meaningful control events in the Compact Framework.

    A ControlRef property is added for completeness but is probably of no use to anyone.

    Dispose has been improved to unhook the added events from the enhanced control but you don't need to worry about this..
     

    Attached Files:

  6. dzt

    dzt Active Member Licensed User

    Ready. .Net CF 1.0 attached.

    Thanks for the opportunity.:)

    It was not so easy as
    Ctrl.EnabledChanged -= EnabledChangedEvent;
    does not compile for .NETCF 1.0 so I changed it to
    Ctrl.EnabledChanged -= newEventHandler(EnabledChangedEvent);

    Cheers
     

    Attached Files:

    Last edited: Oct 5, 2007
  7. agraham

    agraham Expert Licensed User

    Thanks dzt.
    Sorry - C# version 2.0 syntax "improvement" that isn't backwards compatible.

    I'm really a VB man but libraries are better in C# because of all the baggage that VS2005 VB puts in a module and becomes visible in B4PPC, and I have only ever used version 2 as I only have .NET 2.0 on my machine.
     
  8. dzt

    dzt Active Member Licensed User

    Hello agraham (multithreading contact:)),

    Compiling with #develop you can avoid all that baggage. SharpDevelop also has a built-in VB.NET to C#.NET and vice versa, convertion tool.
     
Loading...