Exposed interfaces

RacingDog

Active Member
Licensed User
I've been meaning to ask this for a while....

The help for the B4PObject just says it takes a number as a parameter and gives only one example. So what numbers? What do they mean (ie. what interface corresponds to 1 or 2 etc)? Where do I find details of the corresponding interfaces so that I can use them?

I haven't tried using door yet, I think I'd need a link to a .net cf document. I found a .net document that had embedded comments that an item was also supported in cf, but wading through that morass seemed ridiculous, is there nothing more usable? Maybe it's my age, but I've forgotten where I found that, sigh. I have NET_Compact_Framework.chm but can't open it! I get a window that says "Navigation to the webpage was canceled", useful file then.

One of the help sections for door mentions B4PObject2. Sorry, what?

All of which is prompted by wondering what is the easiest way of changing a FontStyle without using another language (bold, italic, underline, strikethrough).
 

RacingDog

Active Member
Licensed User
Ooer, never had that happen before, which is strange considering the number of freebies I download!

Ta.

Now all I have to do is see if can relate any of it back to B4PPC. Hmmm.
 

agraham

Expert
Licensed User
Longtime User
The Bb4PObjects are only useful to pass as parameters to libraries. They expose various internal objects like the list of controls in an application and the Basic4ppc object itself. They are in fact now of largely historic value as with later versions of Basic4ppc libraries can extract the same information from data provided by the main thread of Basic4ppc without exposing the transfer of that data to view by users.
 

RacingDog

Active Member
Licensed User
Ah, I see. Thank you.

Well I opened that file, little help, just a list with no explanatory text. And no obvious way to search or cross reference. So not a helpful help file, good memory jog if you already know it, but damn all use otherwise. I did get the impression that all the simple operations had been made deliberately obscure, but that maybe just unfamiliarity.
 

agraham

Expert
Licensed User
Longtime User
The .NET Framework, including the Compact Framework, is pretty well documented by the dreaded Microsoft on MSDN .NET Development.

From the list on the left click ".NET Framework 2.0" (this is the version targeted by compiled Basic4ppc applications) "Class Library Reference" then for the visual controls "System.Windows.Forms" then, for example, "Textbox class" then "Textbox members". Members supported on the CF have a little device icon next to them.
 

RacingDog

Active Member
Licensed User
Thanks for that.

But as you say the dreaded MS.

The other night I downloaded the latest C# Express as you reckon C# is the bees knees. See, I do take notice :).

The download was painfully slow, I've had better off dial up. Then the installation was painfully slow. Just to rub the pain in, some nerd had put the installation together in such a way that 2 Restarts were insisted on during the process. Not once afterwards, twice during. Is it really rocket science to do better than that?

Eventually I fired it up and went immediately for the help. This is the help in C# IDE right? So I'm obviously looking for C# help right? Where did I end up? On a web page (good job I was online) for Visual Studio which didn't mention C#! Not to be daunted I studied the available links and picked one that refered to tools and languages. This next page didn't even mention any individual languages. However, I persevered and took a link which looked more hopeful. Then I was on a page which at least listed the languages. So I had to change pages yet again and finally I'm on the C# page. Why the hell wasn't I there to start with?

So where to start? The introduction section? Sounds obvious doesn't it? It starts with Hello World. Nothing wrong with that. It then moves on to brief introductions to all the advanced topics that you won't even think about when you are just getting to grips with language! So another, "fat lot of good" comment. I backed out of that and looked at the other links, took a deep breathe and went for the reference section. You know what these are like, huge and very dry. But no, there, at long bloody last, the introduction to the language I was looking for. So marks for it being there, but what a performance!

We then move on to your kindly provided link. Thank you again.

They list "all" the available versions of .net. Liars. They don't list any version of CF, the only one I want. So having just downloaded the latest C# which comes with .Net 4, I start with that one and read "Compact Framework application development is not supported in Visual Studio 2010. " WHAT? Apart from general worries about future facilities for CF development, this means that all that grief above was totally pointless! I now have to delete that version of C# and find the previous version in order to get CF support.

Do you think I am looking forward to the experience of downloading and installing that version given the above? OK, I musn't prejudge, but my expectations are seriously low. I think it shoud be clear why.

Anyway, as .net 4 was obviously going to be irrelevant, I backed up and took the link for 3.5. That doesn't go to 3.5, it goes to a Bing search dialog. Give me strength!

Working backwards, the .net 3 link seems to work, of course I don't have that version!

Edit: I've started the uninstall, twenty minutes in and we are still going. Had to laugh at the actual C# one though. It didn't remove itself from the Add/Remove list. So I clicked the remove button again and it said did I also want to remove it from the list. I said yes and it said I didn't have sufficient access (my machine, me big chief admin!)! Then it did it anyway! So professional, so professional.
 
Last edited:

agraham

Expert
Licensed User
Longtime User
You can write libraries for Basic4ppc that work on the desktop with any version of VS after 2005, including the free ones. You would need VS2005 Standard (which I use) or VS 2008 Professional to compile libraries for devices. Neither of these is free but Academic versions are/were available for educatioonal use. You can develop for devices using SharpDevelop 2, which is free. Some others here have used it but I haven't so I know nothing about it.

I got the restarts when I installed C# Express 2010. The reason is that the installation installs the .NET Framework 4.0 as well as Visual Studio because the editor in VS2010 is written to use .NET 4.0 and the latest Windows Presentation Foundation. A case of Microsoft putting its money where its mouth is by using its own latest .NET Framework for its flagship developer product.
 

RacingDog

Active Member
Licensed User
Hmmm. Thanks, that just saved me pain. I stopped and watched the Test for a bit then went to pick up #2 son, so I hadn't wasted time downloading the 2008 version.

I don't really want to use these things, more I want to see what on earth it is that door is exposing so that I can use door (should I ever need to).

Having prodded around a bit for the original operation that I wanted, I find that the way to change a font style is, quote,

myControl.Font = new Font(myControl.Font, myControl.Font.Style | FontStyle.Bold);

as opposed to the old native ....

myControl.Font.Style.IsBold := true; // Delphi
myControl.Font.Bold = True // VBA

etc

This is progress? The former is easier, more understandable, more concise? I think not. It fails on all 3 counts.

It also means, I think, (please please correct this if I'm wrong), that I can't do that in B4PPC via door because there is no Font or FontStyle object exposed. Yes? No?

It seems rather overkill to have to provide a dll just to implement one trivial procedure. Surely I've missed something? If not can we please get B4PPC to pretend that it can still be done in the old way? (I'll post in the wish list thread if needed).

In the meantime, I'll have a quick butchas at SharpDevelop, ta.
 

agraham

Expert
Licensed User
Longtime User
Fonts, like many other reference objects in .NET (and Java), most notably Strings, are immutable because it minimises side effects when more than one reference to an object exists. Making them immutable ensures that a new reference is created for the "changed" object so any other references are unchanged.

The attached program changes a font style using the Door library. The Door library doesn't expose stuff as such. It just provides an, albeit rather clumsy, way of tweaking .NET objects without having to create a full-blown library.

P.S. The Font constructor signature you quoted does not exit in the Compact Framework which only implements three of the Font constructors out of the fourteen in the full Framework. You could also look at the SetFontStyle and ChangeFont methods in the FormLib library. :)
 

Attachments

  • FontStyle.sbp
    1.2 KB · Views: 189
Last edited:

RacingDog

Active Member
Licensed User
THanks chaps.

Jeez Graham, that sample's on a par with doing a cryptic crossword! Good job there's that library call I missed then!

Still, it's an interesting question, why on earth would anyone want to dress up what could be reduced to a simple 1 bit attribute into the form of an object? It isn't exactly a showstopping piece of information. I don't think I've ever seen any instance where it would need that type of protection. Serious overkill that.

And that quote doesn't apply to CF? Just goes to show cheepskating on the documents by not having separate documents all too easily leads to mistakes like that.
 
Top