BBC BASIC
« Re: Windows style text input tool:custom size/loca »

Welcome Guest. Please Login or Register.
Jan 20th, 2018, 6:11pm


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Re: Windows style text input tool:custom size/loca  (Read 585 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx Re: Windows style text input tool:custom size/loca
« Thread started on: Apr 18th, 2016, 5:13pm »

on Apr 18th, 2016, 06:31am, michael wrote:
PROC_input(H,V,foregroundR,foregroundG,ForegroundB,TEXTLIMIT,Rbackground,Gbackground,Bbackground)

I would suggest that you take the foreground and background colours as palette indices (i.e. BBC BASIC colour numbers) rather than RGB values. Firstly it makes the interface simpler, but more importantly you cannot assume that any particular palette entries are going to be available for your code's private use.

At the moment you seem to be assuming that it's OK to redefine colours 0 and 1, but it may well not be if they are used elsewhere in the program (and anyway I tend to assume that colour 0 is always black). It's most important that a reusable 'library' procedure does not affect global states (and the palette is a shared global object) unless absolutely unavoidable.

You may also want to accept three or even four different colour parameters, because in practice there will typically be background and foreground colours for the 'text entry box' and background and foreground colours for the surrounding 'dialog box'. The two foreground colours may not need to be different, but the background colours definitely will be.

Quote:
Just to be clear.. This is a stage in development.

Indeed, it's clearly a work-in-progress (not even any LOCAL declarations!). I look forward to seeing something rather more complete and functional.

Richard.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx Re: Windows style text input tool:custom size/loca
« Reply #1 on: Apr 18th, 2016, 6:53pm »

on Apr 18th, 2016, 6:27pm, michael wrote:
I was thinking of making the colors LOCAL to the input box by restoring the default colors

It's an interesting idea. A significant difficulty is how you discover the palette contents in order to save them! There is no documented way (and the details of the palette implementation differ between platforms). Another potential issue is what would happen if your code is running on a hardware-paletted display (I know that's unlikely these days, but it's not impossible); then your 'temporary' changes to the palette could affect regions outside your own box.

But I suppose my main concern is that is adds so much complexity. I am a great believer in the Keep It Simple philosophy, and what you are describing is the complete opposite! You will have enough challenges with the main functionality without complicating what should be a relatively trivial aspect (setting the colours).

Richard.

I have received a complaint about this message.
« Last Edit: Apr 18th, 2016, 10:10pm by Richard Russell » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx Re: Windows style text input tool:custom size/loca
« Reply #2 on: Apr 19th, 2016, 08:32am »

on Apr 18th, 2016, 10:14pm, michael wrote:
So for the default colors, I could check each one with TINT

Yes. I was disinclined to suggest that method, but of course it could be made to work. I just think that passing colour numbers as parameters, rather than RGB values, is simpler (it offloads the responsibility to the caller) and would allow you to concentrate on the primary requirements.

In case it alters your opinion, the colour palette is not something unique to BBC BASIC, it is a feature extensively supported in Windows. Although it originates from the days when the actual display hardware used a Colour Look Up Table, Windows has maintained support for a palette even with RGB displays. You can load colours into the palette (SetPaletteEntries API) and then select your drawing colour by passing the palette index (PALETTEINDEX macro).

This capability seems largely to have been ignored by people developing Windows software. I think there's a general belief that the palette is solely for use when the display hardware itself is paletted, but that's not true. When I first ported BBC BASIC to Windows (in the 2000-2001 timeframe) I was both astonished and delighted to find that the palette support was exactly what BBC BASIC needed, for compatibility with the old BBC Micro and Acorn Archimedes.

Back to the subject of this thread, there are obviously a lot of 'bells and whistles' that could be added but - if my own experience is anything to go by - allowing yourself to be distracted by those too early on is detrimental to the core functionality. They can always be added at the end.

Richard.

I apologise for the - apparently - 'abrasive' tone of my messages in this thread. It's not actually necessary or particularly helpful to draw this to my attention every time.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls