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 ➜ Miniwindows OOP Approach

Miniwindows OOP Approach

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


Posted by Grek   Sweden  (12 posts)  Bio
Date Fri 08 Aug 2008 11:54 PM (UTC)

Amended on Fri 08 Aug 2008 11:55 PM (UTC) by Grek

Message
This is what I've managed to produce so far, I'm pretty
satisfied with it.

http://paste.servut.us/tyuk

Still plenty of potential in it I think.

(2am, first night working on this, some stuff still not perfect :))
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 09 Aug 2008 04:52 AM (UTC)
Message
Looks good, you might want to make helper functions to draw a nice button inside a round rectangle, that shift slightly when you click it, and so on.

A good idea to modularize this stuff.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Grek   Sweden  (12 posts)  Bio
Date Reply #2 on Sat 09 Aug 2008 09:34 AM (UTC)
Message
Yeah, lots of work to do :)

A little sample of what I've done so far, http://i34.tinypic.com/rh5qtv.png

Redirecting tells to that window.

TextWindows are created by specifying top and left distance, it's possible to put them in a container window and have the position relatively calculated. thus by moving the container window you automatically move the content as well, will probably be more useful when creating gauges and buttons.

Adding new text is done with the writeline(line) method.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 09 Aug 2008 09:50 PM (UTC)
Message
You shouldn't have to use a container window. See the way I did help displays here:

http://www.gammon.com.au/forum/?id=8819

To display a lot of text, you just need to cache the text in a table. Then to display a particular page you simply index into the table (eg. if there are 20 lines per page and you want page 3, that is line 60). Then draw the next 20 lines from that point.

The forwards and back arrows, however you draw them (I used a Next and Prev hyperlink, but it could have been arrows on a "scroll bar" on the side) simply add or subtract a page-size from the current position variable.

This method lets you handle massive amounts of text without having to set up large extra windows.

I haven't had time to do it yet, but I envisaged you could make each line a hotspot, and if you clicked on it, it could be selected (ie drawn in inverse) and then copied to the clipboard if wanted.


- 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.


13,798 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.