Mouse Pos oddness


#1

I took the basic hello world example and switched the Component used as the background to a DialogWindow:

I then set the constructor thus:

HelloWorldWindow() : DialogWindow (T("Weeee!!"), Colour(0xFFFFFF00), false)

This gives me a window with an X to close it.

I called setResizeable (true), and I disabled the mouse event handler that closes the window.

Now when I use the left mouse to move the window, or attempt to resize the window, it jumps as if I had clicked in the top left corner ot the application.

I doesn’t seem intuitive that I should need to write specific mouse handlers for an automatic window move/resize operation. I’m guessing I made a newbie mistake, but I’m wondering if anyone else can confirm this or throw a clue my way.


#2

I should add that if you disable the mouse event, you’ll be wanting to override the closeButtonPressed function so that the application can even close out.

Place:

  void closeButtonPressed ()
  {
    JUCEApplication::quit();   
  } 

in the public area of the HelloWorldWindow class.


#3

I think you’ll need to write your own “title bar” into each window… JUCE doesnt seem like it’s meant specifically to use windows UI elements as you’re trying.


#4

You’ve probably left the mouseDown() method in there… it’s used by DialogWindow for mouse-drag, etc. so if you override it, things will go wrong.

Read the DialogWindow docs - it does have its own titlebar, but you mustn’t override any of its paint/mouse methods - you just give it another component to use as its contents-panel.


#5

Sorry I forgot to update this thread. I’d already worked out what I was doing wrong. :oops:


#6