roll your own popup menu

Not that I can see! With your demo on my Mac the teh header of the window dims (showing it has lost focus) when your menu appears… No so with the IDE…

Try changing the menuWindow type to floating window (ignore the title bar) and you will see what i mean, Then you can even keep typing in the textArea as in the IDE… That opens up a lot possibilities… If only the menu window as floating window did not have a title bar!!!

I think the IDE does it that way … That is why I say they should expose that window type to us! The title issue is why i stopped trying to do that long ago… as your type solution did not work the way I wanted and I’m not into declares.

  • karen

I see what you mean now. Sorry, I just glanced on my way out the door.
Yeah, Xojo really doesn’t have a way to do it in pure Xojo code (without declares or plugins) unless you can live with the deactivated titlebar…

If you want a control with nothing else, I see no other way than a container control. Or a contextual menu.

I have a few custom controls that I usually put in a folder, with a module, and a window. That way everything is together and works like a single control.

Personally, I settled a while ago for the container control and listbox approach in Check Writer. I can show a font menu with each font applied to it’s name. The listbox scrolls if necessary, so the constraint of the CC is not really an issue.

[quote=438478:@jim mckay]I see what you mean now. Sorry, I just glanced on my way out the door.
Yeah, Xojo really doesn’t have a way to do it in pure Xojo code (without declares or plugins) unless you can live with the deactivated titlebar…[/quote]

Googling I found declares for this… Have not tried it on Windows but it works on Mac (at least on 10.12.6)

Using this and changing your window type to floating window in your demo it looks like it works fine (at least on a Mac) So it can be coded using a TextArea subclass that a user could just drag onto a window and use.

Imo Xojo should add this (Plain Box Floating Window) to the built in Window styles instead of us have to hunt down how to do it…

I wanted to do this in my early years of using RB (ben using Xojo for over 18 years) … but when I could not find a way in pure RB Code, I dismissed it as a possibility and never revisited it until now…

  • Karen

[code]Public Sub HideTitlebar(Extends W as Window)
#If TargetWindows Then
Declare Function SetWindowLongW Lib “User32” (HWND As Integer, Index As Integer, NewLong As Integer) As Integer
Const GWL_STYLE = -16
Const WS_POPUP = &h80000000
Call SetWindowLongW(W.Handle, GWL_STYLE, WS_POPUP)
#Endif

#If TargetMacOS
dim newStyle As UInt32 = 0 //no titlebar, not resizeable
if W.Resizeable then newStyle = 8 //no titlebar and resizeable

soft declare sub setStyleMask lib "Cocoa.framework" selector "setStyleMask:" (id As Ptr, mask As UInt32)
setStyleMask(Ptr(W.Handle), newStyle)

#Endif
End Sub
[/code]

It is possible to remove the title bar with declares I believe, or with the transparent window technique.

I’m currently on vacation but this is what I remember from the project:
• Metadata for each cell was stored in a custom cell data class.
• The main control class was responsible for such things as managing the custom cell classes, showing / hiding the list, rendering the cells into a picture, responding to user events and filtering. We also implemented event handlers so that subclasses could change the appearance and behaviour very easily.
• An OverlayMBS was used to provide a floating window that displayed the rendered picture. It also captured basic user events which our control class handled. Declares were used to add a scrollbar to the overlay window.
• We also had the need to capture events outside of the control so that we could close the list if the user clicked elsewhere. On macOS we used a MBS class to capture those events and on Windows i’m sure we used a wndproc.

This gave us everything we needed to create custom popup / drop down menus.

To create a combo box control that used our custom list we started by subclassing a Xojo combo box. We then worked out how to detect when the built-in combo box list would appear and how to make our list appear instead. I’m sure this involved another wndproc on Windows - can’t remember with macOS.

So far we have used this to create self contained WYSIWYG font family and font style combo box controls but we have plans to use the technology a lot more in the future.

Kevin… no worries… but the mere mention of MBS caused me to not look at it any further… Nothing against Christian, just against 3rd party plugins in general… but thanks

The Xojo Autocomplete window doesnt use MBS
I dont recall if there were any special IDE hacks, declares, etc to make it work as it does but it is a floating or borderless window

I am going to dive into what Jim posted as soon as the dust clears around here. I have an HVAC crew, a Drywall crew, my General Contractor and his helper on site for the next week or so… after that the REAL work begins

[quote=438612:@Dave S]I am going to dive into what Jim posted as soon as the dust clears around here.
[/quote]

But use a floating window instead of Plain Box (along with above declares to get rid of the title bar), and I think you can do exactly what you want with some work.

[quote]
I have an HVAC crew, a Drywall crew, my General Contractor and his helper on site for the next week or so… after that the REAL work begins[/quote]

My house needs a lot of work badly… but at my age I am worried about spending the kind of money it would take, as i could easily wind up involuntarily retired too!

  • Karen