[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Resize a miniwindow without destroying it

Resize a miniwindow without destroying it

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Mon 05 Apr 2010 09:52 PM (UTC)
Message
I need to be able to resize a miniwindow without losing the hotspot callback history so that I can shrink and expand them with the mouse. Don't worry about repositioning everything inside. I just need to be able to adjust the drawing boundaries during a drag. Is it possible to accomplish currently?

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #1 on Mon 05 Apr 2010 10:00 PM (UTC)
Message
I'd suggest using a separate miniwindow as the draggable spot. That way, you're dragging a miniwindow that doesn't change the whole time.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #2 on Mon 05 Apr 2010 10:48 PM (UTC)

Amended on Tue 06 Apr 2010 12:40 AM (UTC) by Fiendish

Message
Yeesh, sounds like yak shaving. As much as I appreciate possessing the ability to work around problems, I'd rather see a clean solution instead. But thanks for the suggestion. For now I'll try it out, but I still think we need a Resize function that doesn't arbitrarily destroy all the callbacks.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 06 Apr 2010 05:01 AM (UTC)
Message
You could use WindowHotspotInfo to find what the current hotspots are:

Template:function=WindowHotspotInfo WindowHotspotInfo

The documentation for the WindowHotspotInfo script function is available online. It is also in the MUSHclient help file.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #4 on Tue 06 Apr 2010 02:57 PM (UTC)
Message
Nick, I don't think I quite understand. I'll play around with this info later, but can you offer any advice on using this to recover, for example, the fact that the mouse is currently still pressed (press starts before the resize, resize destroys the callback history so the drag handler stops working) without reclicking? I mean... a way to manually set the dragging bit after re-creation might work too, but it seems like non-destructive resize functionality would be really useful in this scenario.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Tue 06 Apr 2010 11:30 PM (UTC)
Message
I see what you mean. Changing hotspots during a mouse-down isn't a great idea, because it gets confused about having a mouse-down for something that ceases to exist.

I'm not sure about the resizing. Simply allowing the box to grow or shrink wouldn't totally solve the problem, because GUI elements (like the resize graphic itself) have to move too.

Either the window would have to redraw frequently, repositioning things, or it would look silly.

My interim suggestion is to experiment with creating a new "border" window (like the old days when you resized a window in Windows, you just saw an outline of the new size). The border window could be implemented by having a transparent inside, and a grey 2-pixel or so border. This new window could be deleted and redrawn each time the mouse moves, effectively visually showing you what the new size is going to be. And then when you let go, you recreate the window with the new dimensions.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #6 on Wed 07 Apr 2010 01:08 AM (UTC)

Amended on Wed 07 Apr 2010 01:11 AM (UTC) by Fiendish

Message
Quote:
Either the window would have to redraw frequently, repositioning things, or it would look silly.

This is what I want to do. It's not that hard, and I'd be totally happy with that stuff left to the user.

I'm experimenting with Twisol's idea. I've gone and made the modifications to movewindow.lua that I ... oh hey, you've done one of them. This is why I like you so much.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Thu 19 Aug 2010 06:33 AM (UTC)
Message
Fiendish said:

.. oh hey, you've done one of them. This is why I like you so much.


<grin>

Now added a miniwindow resize function in version 4.58. Moving things inside the window around will be your problem, however the function copies the existing window contents to the top-left corner of the resized window.

Existing hotspots, images, fonts are retained.

Also added a move hotspots function so you can move the resizing hotspot.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #8 on Fri 20 Aug 2010 11:36 PM (UTC)
Message
Awesome. Technical question, though...
When I first thought about asking for this way back when, I thought the necessary code changes would be on the order of one or two lines. Actually...I didn't really look very long at the code and just sort of made assumptions about how miniwindow creation stuff worked and thought that all you would do would be to add another bool parameter to createwindow that would optionally not call deletehotspots() or whatever it's called.

I was a bit surprised to see the extent of the change. Why that way? Do I need to go and actually read through the code now to see how stuff works? :)

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #9 on Fri 20 Aug 2010 11:47 PM (UTC)

Amended on Fri 20 Aug 2010 11:51 PM (UTC) by Twisol

Message
Abandon hope, all ye who enter here. :D

No, actually, I agree with making it its own function, at least script-side. It makes it much more obvious what exactly you're trying to do.

As far as adding a bool to Create(), there's a lot of other code in there that's irrelevant to sizing a window, which is all Resize() does. And Resize() isn't very complex; all it does, AFAICT, is copy the bitmap.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Sat 21 Aug 2010 12:11 AM (UTC)
Message
Yes I see what you mean. I suppose a flag to keep hotspots would have been simpler. Oh well, it isn't as if it was hundreds of lines of code.

Anyway, the WindowResize function keeps the existing contents (at least the original contents) which may or may not help.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Tue 24 Aug 2010 09:24 PM (UTC)
Message
Fiendish said:

I ... thought that all you would do would be to add another bool parameter to createwindow that would optionally not call deletehotspots() or whatever it's called.


I added this flag to version 4.59.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,309 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]