DoorEx library

Discussion in 'Additional Libraries' started by agraham, Mar 25, 2009.

  1. agraham

    agraham Expert Licensed User

    This library extends the functionality of the Door library. This first version implements a "FromString" method that will obtain the reference to either a Basic4ppc control or external library object when provided with the name of that control or object as a string.

    The reason for providing this is that you can't indirectly address a library object using the Control keyword in an optimised compiled app because the optimised compiler needs the Control(name, type) form of the Control keyword and "type" cannot be a variable and so is limited to the one type of control specified at compile time. Using "FromString" you can get the reference and then get or set properties or run methods using the Door library.

    EDIT : Version 1.1 posted. See post #6 for details

    EDIT : Version 1.2 posted. With Erel's permission this library now includes all the original Door library functions so can it be used as a replacement for instead of alongside the Door library which makes some things a little easier. See post #11 for details.
     

    Attached Files:

    Last edited: Sep 23, 2009
  2. Byak@

    Byak@ Active Member Licensed User

    Agraham it is great!big thanks!you are my Hero))
     
  3. Byak@

    Byak@ Active Member Licensed User

    Sorry that I ask here...
    Code:
    obj.SetProperty("ForeColor",rgb(255,0,0))
    return error
    how can i convert string to color? :-[
     
  4. agraham

    agraham Expert Licensed User

    There's an example in Door help->Overview->Passing color value
     
  5. Byak@

    Byak@ Active Member Licensed User

    big thanks)
     
  6. agraham

    agraham Expert Licensed User

    If you thought the Door library was a bit arcane :)

    I've been playing over the last couple of days passing things around between libraries and Basic4ppc code and have provided a few more things that made it easier to do some things with the Door library. The most useful for mere mortals is probably ValueToColor, "obj.ValueToColor = cRed" or "obj.ValueToColor = RGB(255,0,0)", which saves a lot of typing. See the help for details.

    I won't attempt to provide a demo file for this. If the help is not enough then you probably need to learn more about .NET.

    I am happy with GetProperty for collections indexed by keys but I have not thoroughly tested the SetProperty variants, but as the famous last words said "it should work" (but probably won't)

    Erel once amusingly wrote to me in an email "However it wasn't checked and therefore it doesn't work :(". I should frame that one really and put it on the wall :) As Richard Feynman wrote about the fine structure constant "it's something every physicist should write on their blackboard and worry about!"
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    LOL :)
     
  8. epsharp

    epsharp Member Licensed User

     
  9. Erel

    Erel Administrator Staff Member Licensed User

    You don't need to use any library for this.
    Code:
    Sub Globals
     
    Dim Type (R,G,B) clr
    End Sub

    Sub ...
     somestring = 
    "255,0,0"
     clr() = StrSplit(somestring,
    ",")
     Button1.Color = RGB(clr.R, clr.G, clr.B)
     
  10. epsharp

    epsharp Member Licensed User

    Erel,

    Once again, thank you for your help. It's all so simple when you just know how.

    Ed Sharp
     
  11. agraham

    agraham Expert Licensed User

    Version 1.2 of DoorEx now posted has had, with Erels' permission, the original Door library source merged into it so is now a replacement for it.

    This version adds Field access which was a notable (for me at least) omission from the original Door library. The ValueXX properties have had a few more added.

    Because there are often successive assignments to a DoorEx Value property you probably, like me, when debugging check each stage with something like
    "MsgBox(objex1.RunMethod("ToString"))" to see that you've got the expected object. For convenience while developing a fragment of DoorEx code I have added several enumeration methods that return the Events, Fields, Methods and Properties of the current object in an ObjectEx. There is also an enumeration of the EventArgs property for a given Event and an eumeration of a Methods' signatures. These can reduce the trawling through MSDN. There is a module in the demo that you can use, and extend if needed, when developing a bit of DoorEx code and can remove from the project when no longer needed.
     
  12. nl1007

    nl1007 Member Licensed User

    TextAlign

    I tried out setting "TextAlign" to "Center" for some textboxes, and it works OK on the desktop, but not on the device. Is this a limitation? Where can I find out what should work on the device?
    The 'GetMethods' and 'GetProperties' functions are very handy! Thanks :)
     
  13. agraham

    agraham Expert Licensed User

    Google and pick the MSDN link that usually comes up or browse the MSDN .NET Developer Center itself .NET Development. From the list on the left click ".NET Framework 2.0" then "Class Library Reference" then "System.Windows.Forms" then "Textbox class" then "Textbox members". Ones available in the Compact Framework have a little device icon by them. Unfortunately the "TextAlign" property link is broken but from elsewhere in MSDN
     
  14. nl1007

    nl1007 Member Licensed User

    Thankyou for the speedy reply.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice