BevelButtonReplacement class

Norman has made a replacement class for the BevelButton.

Rather than hijack another thread I started this one to report some issues.

I ran it in Xojo 2018 R3 in MacOS X High Sierra 10.13.6 and what I see:

• bevelButtonReplacement9 and bevelButtonReplacement11 have a black background (both are ButtonType button). Turning Transparency on fixes this.
• black outline for each button
• no checkmarks for selected items

this is why you get 100% source code for free

fix what you feel like fixing
send those back to me and I’ll diff it an update (maybe one day I’ll post it on github or something)

this is now on github

updated to fix a couple bugs
adds sticky and toggle button types
adds icon support

If you’re using the current RegExRX, you’re using Norman’s BevelButtonReplacement.

Not sure what it fixes ?

I tried to put a real bevel button next to or close by every replacement o you can check them against each other
here on 10.14 they all look like their bevelbutton counterpart at runtime EXCEPT mine switch to dark mode where the real ones remain glaringly white

ah in the menu … hmmm

pushed new updates that should correct the check mark issue

aint that fun
in 2018r3 its different than in 2019r1.1 both on 10.13

and fixed
draws properly in 2018r3 (and possibly older) without having to tweak the transparent property setting

Thanks, Norman for the effort. I am struggling to get the value or name from the selected menu item. When I stop the code with break, it shows me that MenuItem is loaded with the right name and value, but when using Event Handler MenuAction it will not recognise either. E.g.:

Var menuResult as String
menuResult = MenuItem.Value
menuResult = MenuItem.Name

Error: MenuItem.Value and MenuItem.Name do not exist

How do I get the values out of the array?

Thanks! @Norman Palardy

The MenuAction event is passed the menu item and its named ITEM
Your code can get whatever property of that item using code like

dim menuResult As String
menuResult = item.Text
menuResult = item.Name 

Thanks @Norman Palardy , awesome!

Hi Norman, thanks for the great BevelButtonReplacement… Trying to get a Popup menu filled with the fonts. So far I have this but it’s only populating it in one line… Any ideas? Thanks!

dim arrayString as string

Dim fCount As Integer = FontCount
For i As Integer = 0 To fCount-1
arrayString = arrayString + chr(34) + (Font(i)) + chr(34) + chr(44) + chr(32)

Dim groups() As String = Array(arrayString)

For Each m As String In groups

Thanks again @Norman Palardy

arrayString + chr(34) + (Font(i)) + chr(34) + chr(44) + chr(32)

CHR(34) is " quote

CHR(44) is comma
CHR(32) is a space
Not sure why you have all those floating about

I dont have this code to hand, but if you intend to ADDROW from the GROUP array,
why not just

[code]Dim fCount As Integer = FontCount
For i As Integer = 0 To fCount-1
bevelButtonReplacement(obj).AddRow( (Font(i)))

//Dim groups() As String = Array(arrayString)

//For Each m As String In groups

Oh, thanks Jeff - nice and simple… My logic was stuck! Thanks for the fix!

I might be missing something but I’m just trying to get the button to show when it is temporarily depressed (between mouseDown and mouseUp). Something like a temporary darkening (or lightening in dark mode)

I’ve tried a few things but it’s tough to tell if it already has the feature or it’s a side-effect of some other setting?

I dont think I made that work
Feel free to clone the github project and fix that and submit the changes back
That way everyone gets them

does you button have a menu as well ?
that seems to be the only time it doesnt do this already

Hi Norm, thanks for the Bevel Button fix. For the most part it is working fine.

The one problem I can’t seem to get to work is to get the Caption Placement to centre under an icon, it puts the text in the middle over any icons I put there.

I put this which suits my purpose but was wondering what would actually make it robust for the other options
titleY = (g.height - captionHeight) '+g.TextAscent/2

I’ll have a peek at it later today