B4J Tutorial Floating ContextMenu using jNativeHookB4j

ThRuST

Well-Known Member
Licensed User
Longtime User
AquaFX on my PC. Menubar (hovering over Help), label, button, ComboBox and RadioButton.

 

stevel05

Expert
Licensed User
Longtime User
I don't use a Mac so I can't tell if it's any good or not.

I've added the css file separately to the first post. I have a feeling it may get more changes than the code.
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Will controls look like this on Mac only? I don't fully understand how to use AquaFX. I was thinking it was used to support only CSS.
It changes the layout of the controls on every system then, I assume?
 

stevel05

Expert
Licensed User
Longtime User
Yes, all of the controls styling are based on a css file, for Javafx 8 the default is the Modena.css. This just modifies or maybe replaces that with some Mac type stylings. It says it won't work for all view on all PC's, so you would probably wan't to selectively load it, only if it's running on a Mac.
 

ThRuST

Well-Known Member
Licensed User
Longtime User
This is what it looks like on my Mac. So all I have to do is to include the reference to the #AdditionalJar and only run the selected code if O/S is a mac?
Will it then display the CSS themes correctly on a mac?

B4X:
Dim AJO As JavaObject
    AJO.InitializeStatic("com.aquafx_project.AquaFx")
    AJO.RunMethod("style",Null)


AquaFX v0.1 on Mac

 

ThRuST

Well-Known Member
Licensed User
Longtime User
Steve, I tested your code with Aqua FX v0.1. This is what it looks like on my PC. Will give it a try on mac as well.

 

stevel05

Expert
Licensed User
Longtime User
That I don't know. It may help. But then again.

Just add it to the floating menus app and give it a try.
 

stevel05

Expert
Licensed User
Longtime User
You beat me to it.
 

ThRuST

Well-Known Member
Licensed User
Longtime User
AquaFX with ContextMenu looks like like on PC, but a bit different when the mainform is not in focus. Those blue lines is part of the layout even on Mac when it's focused. I did not include the broadway font in the files folder, so maybe that will do it.
 

ThRuST

Well-Known Member
Licensed User
Longtime User
I have added the boardway TTF font to the files folder in contextmenu v085, is there all there is to it? will B4J make use of it perhaps? let's try.
 

ThRuST

Well-Known Member
Licensed User
Longtime User
It did not work to just include the font in the files manager and run it on a Mac without AquaFX. I will try to enable AquaFX again I'm on it again. gosh
 

ThRuST

Well-Known Member
Licensed User
Longtime User
I found an example for B4A how to use custom fonts. That might work in B4J

B4X:
Dim Sonda As Typeface
Sonda = Typeface.LoadFromAssets("wurm.ttf")
Dim dialog As CustomDialog
Dim lb As Label
lb.Initialize(dialog)
lb.Typeface = Sonda
lb.TextSize = 16
lb.Text = "This is my text what I write for B4A forum." _
&CRLF& "Ho Ho Ho Ho" _
&CRLF& CRLF& _
"Today is a beautiful day here in Croatia :)"

dialog.AddView(lb, 0dip, 0dip, 100%x, 100%y)
dialog.Show("My Title", "OK", "Cancel", "No", LoadBitmap(File.DirAssets, "nfo.png"))
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Actually in B4J it should be

B4X:
Private myFont As Font=fx.LoadFont(File.DirAssets,"BROADW.TTF", 15)
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Thanks for telling me, but this was also part of an important test. I installed the font via Font Book in my Mac and then I disabled AquaFX and compiled your code (v085) and ran it on my Mac. This is what it looks like. It can be a good idea to find nice fonts that can be used on any computer without violating the copyright, or there will be a royalty fee to pay which is not really needed since there's many nice fonts to choose from. If you find some you like let me know. Since it runs without AquaFX, I see no need to include support for it, if it's not for other systems I dunno.


Looks pretty darn good if you ask me Been here done dat
 

stevel05

Expert
Licensed User
Longtime User
Yes looks good, so had that fixed the highlighting issue?
 

ThRuST

Well-Known Member
Licensed User
Longtime User
No, I just tested it and it's the same. Those menus look nice but the selections is not active. However it works as it should so it's not really a problem, even though it would be nice to have it working just like on Windows. So just one 'bug' to correct to make it v1.0 This might not really be a bug, since I'm pushing CSS too far.
It would be nice with some colors and stuff since CSS invites for it so I really want to use it. Possibly on every platform. Did you set focus to it?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…