Android Tutorial [B4X] B4A, B4i, B4J and B4r API documentation - B4X Object Browser

Status
Not open for further replies.

Roger Garstang

Well-Known Member
Licensed User
Longtime User


Looks about the same. Might actually be a slower flicker now like there is some type of a pause or DoEvents call after each element is added. Posting the code used to update/add the elements may help suggest other ways to do it.
 

Vader

Well-Known Member
Licensed User
Longtime User
Looks about the same. Might actually be a slower flicker now like there is some type of a pause or DoEvents call after each element is added. Posting the code used to update/add the elements may help suggest other ways to do it.

I actually removed the Application.DoEvents() that was in there.

B4X:
            TargetTreeview.BeginUpdate();

            if (Properties.Settings.Default.ShowMethods)
            {
                // Methods
                foreach (Method ThisMethod in ThisClass.Methods)
                {
                    TreeNode MethodNode = new TreeNode();

                    MethodNode.Text = ThisMethod.Name;
                    MethodNode.Tag = ThisMethod;
                    MethodNode.ImageIndex = 2;
                    MethodNode.SelectedImageIndex = 2;

                    TargetTreeview.Nodes.Add(MethodNode);
                }
            }

...
...

            // Sort the treeview
            TargetTreeview.Sort();

            TargetTreeview.EndUpdate();
 

Roger Garstang

Well-Known Member
Licensed User
Longtime User
I don't think that is the code doing this. That code appears to be adding nodes directly at root level of the treeview. Those would be the Library Names. The flicker is when clicking the Library names and it fills in the child nodes like the Properties and Methods. I'm confused though why the variable is called Methods unless 1. You are calling the Libraries Methods or 2. Each Library at the Root is a Treeview...which I didn't think was possible or needed since the treeview has a Nodes collection and each Node can have child nodes in its Nodes collection.

If the the treeview is always sorted, the easiest thing to do would be to set Sorted to True for the Treeview then they are inserted sorted. The only time sort needs called then would be if label text of a node changes which wouldn't happen here. Other options would be to use an array or some other type of collection to sort behind the scenes then just insert the nodes without calling sort at all.

I'm not sure where the DoEvents was, but I don't think it is needed here. Usually it is for loops like this so the GUI doesn't stop being responsive, but if use here it will just allow them to drag the window while updating which would either abort the Begin Update and make things ugly or update a blank TreeView which would look odd (Especially if it gives it a null brush where other things behind it or placed on top of it are drawn in it). Having the window stay put and not handle other events until finished would be best.
 
Last edited:

Vader

Well-Known Member
Licensed User
Longtime User
Ok, so I have found a few things that I had missing...

  • Class events
  • Class permissions
  • Class dependencies (ie dependson)

Those have now been added.

I also added the ability to do a Google search of the B4A site for any given term (entered at a prompt). Nobody asked for it, but I thought it was a missing feature.

Now before you start looking for the new version in Post #1, here is the bad news...
I have yet to add the Method attributes (e.g. DesignerName).
I am also not happy with the interface - it is starting to look quite cluttered at the top.

Because of the above reasons I have decided to not release the next version tonight. I will work on these things tomorrow night and over the weekend as necessary, and get something to you that is functional AND pleasing to the eye.

Oh yes, I forgot to add... I do plan on supporting multiple languages.
I will have to pull out all of the English text into a resource file first, and then I will be able to add French, German, Italian, Chinese, Spanish etc.
Warning: I will need help with these languages. My German is pretty rusty, and I can't speak any of the others. This will come later. Maybe version 3.0?

Ciao
 

Vader

Well-Known Member
Licensed User
Longtime User

Here is the complete Method...

I may have found it... there was a rogue "statusbar.refresh();" in there. I will do some more testing over the next night or two and post an update with the other changes mentioned above.

Edit: And there is no .Sorted property on treeview, that is why the .Sort() method is there.
 

Vader

Well-Known Member
Licensed User
Longtime User
Ok, found the bug. My EndUpdate() was inside a loop.

FIXED!

If you really want to get the updated version earlier than everyone else, send me a PM with your email address and I will zip it and send it to you, or provide you with a link.
 

Roger Garstang

Well-Known Member
Licensed User
Longtime User
Ok, found the bug. My EndUpdate() was inside a loop.

FIXED!

If you really want to get the updated version earlier than everyone else, send me a PM with your email address and I will zip it and send it to you, or provide you with a link.

Cool, figured it was something simple since the code posted looked fine. I'll just wait for the update. I'm not more special than anyone else or anything.

Weird that there was no Sorted Property. I was reading through documentation and forum stuff online seeing if Sort broke out of BegineUpdate or something causing the flicker and it described a Sorted Boolean property. There is overhead either way and a temp array or something to sort usually works better anyway. In my other PowerBASIC applications I don't even let the Listviews and Treeviews handle the data and provide it to them on request. This makes very fast interfaces and allows me to store the data in the best manner.

If you've never heard of it- JetBrains has an awesome tool called ReSharper that I always use in Visual Studio. It provides lots of hints and refactoring as well as studies code to let you know of possible errors like unused variables, unreachable code, redundant code, things in a loop that shouldn't be, etc. In your code you posted it would suggest things like doing away with the three lines setting label and the two images of the node and using the alternate constructor where you specify label and the images, etc. It even analyses IF and other statements letting you know the best order to put things in. Eazfuscator is another great and free obfuscation tool I use to protect my code.
 

BasicBert

Member
Licensed User
Longtime User

Since I get annoyed by bad translations into Dutch, I might as well try to do it myself. Since I usually think of criticism as being good advice I might as well take this "job". I'm doing the same for Kuffs Password Safe for more then a year now, so there's a bit of experience.
When you're ready for this part of your project, just let me know.
 

derez

Expert
Licensed User
Longtime User
I added comments to the methods that missed them and now the class based library show without errors, thanks !

I noticed that methods like the following
B4X:
'Sets the color of the line between the title and the message
Public Sub Line_Color(color As Int)
line.color = color
End Sub

are displayed like this:
_line_color

Type
Method

Description
Sets the color of the line between the title and the message

Syntax
_line_color(color As int) As String

Return Value
String

The program added "As String" and "Return Value" where there is none !
 
Last edited:

Vader

Well-Known Member
Licensed User
Longtime User

Can you please send me the xml you have so that I can see what is happening.

Thanks
 

Vader

Well-Known Member
Licensed User
Longtime User
The B4A functions always return a string (implicitly). When you convert classes into libraries, I suppose that you keep this type for the return value (instead of void).

Great, so the tool will be functioning as the XML is directing it.
 

derez

Expert
Licensed User
Longtime User
Anyway, the xml is attached.
 

Attachments

  • Message.zip
    5.9 KB · Views: 426

Vader

Well-Known Member
Licensed User
Longtime User
Does anyone have a Library that uses the @Hide annotation? I need to test this annotation.
 

corwin42

Expert
Licensed User
Longtime User
AHViewPager library. The AHPageContainer object uses lots of them.
AHQuickAction library. In AHQuickAction(3d) object there is at least setRootViewId() method hidden with it.
 

Vader

Well-Known Member
Licensed User
Longtime User
AHViewPager library. The AHPageContainer object uses lots of them.
AHQuickAction library. In AHQuickAction(3d) object there is at least setRootViewId() method hidden with it.

Thanks Markus. Informatix is correct, that Method is not listed.
 

Vader

Well-Known Member
Licensed User
Longtime User
Update 2.4.0.0

Ok, so I have a few things to explain here...

Firstly, the GUI has changed a little because it was starting to get too cluttered. I'm not a 100% fan of the end-result, but I hope you agree it is functional and kind-of pleasing to the eye.

There are now three additional listboxes to show additional information. These are:
Depends On
Permissions
Events

These show what other Classes the selected Library/Class depends upon, what permissions the Class requests/requires, and what Events are generated by the Class.
This last one is a favourite of mine, because I don't know where else in the IDE this information is shown (if at all).

Next, the Comment area AND the Details area are both HTML aware. Well, mostly they are. This means they understand <u>, <b>, <i>, <link> etc.
At this time, <code> is stripped out and not handled that well, but at least the examples read a little better now.

I have also moved one of the Toolbar buttons so as to keep the B4A site buttons together. The Android Packages button is now last (i.e to the right of the others).

There is an additional button to allow text searching the B4A site for any text you wish to enter. This is in addition to the pre-existing ability to search the B4A site for any selected text.

The comment area can now be "Copy"'ed and "Copy RTF"'ed, thus preserving links, colours etc.

You can perform a search from selected text in the Comment area.

EDIT: I nearly forgot: The flickering is now fixed!

I still don't have a solution to the Unicode problem (sorry Informatix), and the HTML codes are not 100%, but I hope you agree they are much better than what I had previously.

When you unpack the zip (in Post #1 as always), please note there is now an additional DLL that must also be copied. This is the control that handles the HTML in the Richtext boxes as described above.

Again, you will have to re-create your config. I will work on pulling the config out from .NET, but for now we have what is standard, which changes with every version.

Please do not hesitate to ask or report anything you feel I have missed. Chances are I will incorporate your suggestion into the next version

Enjoy!

Dave
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…