DoorEx library

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.
 

Attachments

Last edited:

Byak@

Active Member
Licensed User
Agraham it is great!big thanks!you are my Hero))
 

Byak@

Active Member
Licensed User
Sorry that I ask here...
B4X:
obj.SetProperty("ForeColor",rgb(255,0,0))
return error
Object of type 'System.string' cannot be converted to type 'System.Drawing.Color'
how can i convert string to color? :-[
 

Byak@

Active Member
Licensed User
big thanks)
 

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!"
 

epsharp

Member
Licensed User
If the help is not enough then you probably need to learn more about .NET. [/QUOTE said:
I can't find the solution in any .NET searchs.


mycolor = "255,0,0"


Button1.Color = mycolor (Doesn't work)
Button1.Color = RGB(mycolor) (This too)

In my app, MYCOLOR isn't really a variable, but the foreground and background colors (in RGB) are in a Class Flag Color database table. The button color needs to change (and rechange) depending on the Class selected.

Could I have just a tiny, one line example of how to change color when the desired color is a TEXT item in a database? :sign0104:

Regards

Ed Sharp
 

epsharp

Member
Licensed User
Erel,

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

Ed Sharp
 

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.
 

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 :)
 

agraham

Expert
Licensed User
Where can I find out what should work on the device?
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
.NET Compact Framework Platform Note: In Pocket PC applications, a single-line TextBox supports only left alignment. A multiline TextBox can be aligned on the left, right, or center.
 
Top