B4A Class DOTips 2.7 - show an overlay for app tips

Dave O

Well-Known Member
Licensed User
Longtime User
Hi all, I've uploaded version 2.2:

- added option to remove Skip button
- added true/false argument to Hide so you can suppress the OnHide event if needed (in most cases, just replace hide with hide(true))
- fixed spacing under buttons
 

Dave O

Well-Known Member
Licensed User
Longtime User
Hi all, I've uploaded version 2.4:

- fixed a positioning bug in addTipForArea when inside a scrollview
- fixed OnHide signature so it auto-completes properly
 

Lello1964

Well-Known Member
Licensed User
Longtime User
Hello Dave, thanks for share your class.

I don't see how back to previus tips. ??
 

Dave O

Well-Known Member
Licensed User
Longtime User
There's no current way to go back to previous tips, although that would be easy to add. The main challenge would be making room for a third button (or moving the Skip button to a small close icon at the upper right, and putting Previous where Skip was). I'll give that some thought.
 

Lello1964

Well-Known Member
Licensed User
Longtime User
I think it would be useful.
 

Dave O

Well-Known Member
Licensed User
Longtime User
Can we use this class cross platform?

Short answer: not yet, but shouldn't be hard for someone to port.

I haven't had the time (or need) to do any cross-platform apps yet, and haven't looked into what's involved in making a class/library/app work on other platforms, so I don't expect to create a cross-platform version of DOTips any time soon.

However, for someone who knows more about cross-platform stuff, this would probably be an easy class to port over. It uses basic controls (panels, labels, etc.) and most of the code deals with layout, which should be pretty portable. Also, the class only uses a few basic libraries - nothing exotic.
 

SMOOTSARA

Active Member
Licensed User
Longtime User
Hi dear friend (Dave O) ?
Thank you for the very useful and open source module?

How can I set the text Gravity (Gravity.RIGHT) for Titel and Description to RIGHT ?

Thanks.
 

Dave O

Well-Known Member
Licensed User
Longtime User
Hi all, I've updated this class to v2.6. See the updated files in the first post.

The only change is to better handle the system font size (which the user can change from normal to much smaller or (more commonly) much larger).

The new version of DOTips automatically compensates for these system font-size changes by only changing the tips' text size slightly, so that:
- A very small system font size only makes the tip size slightly smaller than normal.
- A very large system font size only makes the tip size slightly larger than normal.

This should make it easier for us as developers to make tips appear as we designed, regardless of the system font size in play.

Cheers!
 

Dave O

Well-Known Member
Licensed User
Longtime User
Hi all, I've updated this class to v2.7. See the updated files in the first post.

The only change is to fix a crash on showing tips for views on certain versions of Android (e.g. Android 11 Go Edition). The GetRelativeLeft and GetRelativeTop subs (from @stevel05) were missing a Try clause for some reason, so I reverted to his original code.
 

asales

Expert
Licensed User
Longtime User
I tried to use this classe in a b4xpage, but I get this error:
B4X:
dotips_vvvvvvvvvvv0 (java line: 1779)
java.lang.IllegalArgumentException: width and height must be > 0
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1113)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1080)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:1030)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:991)
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:81)
    at b4a.example.dotips2.dotips._vvvvvvvvvvv0(dotips.java:1779)
    at b4a.example.dotips2.dotips._vvvvvvvvvvvvvvv5(dotips.java:2190)
    at b4a.example.dotips2.page2._b4xpage_created(page2.java:54)
    at b4a.example.dotips2.page2.callSub(page2.java:89)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1098)
    at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1069)
    at b4a.example.dotips2.b4xpagesmanager._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv0(b4xpagesmanager.java:528)
    at b4a.example.dotips2.b4xpagesmanager._vvv3(b4xpagesmanager.java:865)
This is the code:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("layout2")
    
    tips.Initialize(Me, Root, "tips")
    tips.addTipForView(Button1, "Position", "You can change most of the look and feel to suit your app.")
    tips.show
End Sub

The project is attached.

I'm doing some wrong?
Thanks in advance for any tips.
 

Attachments

  • dotips_b4xpages.zip
    27.4 KB · Views: 102

asales

Expert
Licensed User
Longtime User
I tried to use this classe in a b4xpage, but I get this error
I think that I fixed with change this lines:
B4X:
Dim xui As XUI

Public Sub Initialize(objectArg As Object, activityArg As B4XView, eventPrefixArg As String)
    callbackObject = objectArg
    
    tipActivity = xui.CreatePanel("tipActivity")
    tipActivity = activityArg
    
    (...)
End Sub
 

Dave O

Well-Known Member
Licensed User
Longtime User
Hi @asales , thanks for reporting this. I haven't tried B4XPages yet (have just been using standard Android activities), so I don't have any advice about adapting DOTips to it, but it looks like you may have already solved this with the code above? That will be useful for others who are using B4XPages - thanks again!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…