Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Miniwindows ➜ Re-creating vs "blank slate"

Re-creating vs "blank slate"

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


Posted by Renny   Canada  (26 posts)  Bio
Date Thu 23 Aug 2018 07:47 PM (UTC)
Message
In the documentation it says,

Quote:

Once the window has been created by a call to WindowCreate, you can draw to it anytime. You may find it useful to clear the window and start again "on a blank slate". For example:


WindowRectOp (win, miniwin.rect_fill, 0, 0, 0, 0, ColourNameToRGB("white"))
This clears the entire window to white.


If i want to discard everything (save for the loaded font and images) and redraw the "main content" to update the window, should I use WindowCreate or do the above?

Are there any tangible differences? Perhaps to do with memory freed etc.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 23 Aug 2018 09:08 PM (UTC)
Message

There are a few differences. The miniwindow instances (in memory of the client) can have associated with them:

  • Hotspots
  • Fonts
  • Images

These are not deleted if you do a WindowCreate on an existing window. If the miniwindow already exists the only thing that is freed up is the bitmap representing the window contents, and that is then re-created (quite possibly with different dimensions).

A fairly standard technique, for example, is to create a miniwindow of small dimensions (eg. 1x1 pixel), add a desired font to it, find the font dimensions (eg. line height) and then do another WindowCreate to resize the window as required (eg. 2 lines of text high).

The help message about the “blank slate” is intended as a tip for situations where you simply need to clear the window, for example, when drawing chat messages, so that the old text does not get written over previous text. It doesn’t literally mean “as if made from scratch”.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


9,034 views.

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

Go to topic:           Search the forum


[Go to top] top

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