BBC BASIC for Windows
Programming >> User Interface >> buttons
http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1272995596

buttons
Post by nitwit on May 4th, 2010, 5:53pm

Or more precise 'rectangular pushbuttons'.

I've defined some characters (using pages 198 and 476
of the PDF version of the 'guide' - must be important stuff to appear twice!)

I want these to appear in the buttons but all I get is a thick vertical line. (They print on the screen OK). What's going wrong?
Re: buttons
Post by admin on May 4th, 2010, 10:06pm

on May 4th, 2010, 5:53pm, Guest-nitwit wrote:
I want these to appear in the buttons but all I get is a thick vertical line. (They print on the screen OK). What's going wrong?

User-defined characters (created using VDU 23) are a feature provided by BBC BASIC's VDU drivers; they are part of the BBC Micro (Acorn) emulation subsystem built into BB4W for compatibility with earlier versions of BBC BASIC.

Output to a Windows control (like a push button, list box, static control etc.) is completely independent of the VDU drivers and takes place via a totally separate route (calling the Windows API).

So none of the facilities provided by the VDU drivers is available when you output to a Windows control. They are two quite separate ways of creating output - one compatible with Acorn OSes and one compatible with Windows.

To achieve what you are attempting would require you to convert the required symbol to a bitmap and then display that on the button. You could adapt the code recently discussed on the group:

http://tech.groups.yahoo.com/group/bb4w/message/13181

(using a button with the BS_BITMAP style).

Richard.

Re: buttons
Post by nitwit on May 28th, 2010, 6:54pm

That link takes me to a 'sign in page'. I don't want to sign up. In any case I suspect that the discussion would be too technical.

As a possible alternative, I see Sprites are available (page 877 of the 'guide') but there is no mention of a response to a mouse click. Is that not implemented?
Re: buttons
Post by admin on May 28th, 2010, 9:27pm

on May 28th, 2010, 6:54pm, Guest-nitwit wrote:
That link takes me to a 'sign in page'. I don't want to sign up. In any case I suspect that the discussion would be too technical.

The link was to the BB4W discussion group. You ought to be a member, as it's the 'official' support group for BBC BASIC for Windows. It's also where any files referenced from this forum will be stored (since Conforums doesn't have an upload area), and you need to be a member to access them.

In particular, the message to which I linked itself links to this program:

http://groups.yahoo.com/group/bb4w/files/Graphics/drawstaticbox.bbc

which shows how to draw onto a Static Box. The code could be adapted to draw onto a button.

Quote:
As a possible alternative, I see Sprites are available (page 877 of the 'guide') but there is no mention of a response to a mouse click. Is that not implemented?

There's no provision for sprites to be used as buttons, if that's what you mean. The whole point of a sprite is that it can move 'in front of' the background, without erasing it. Buttons don't move (usually!), so a sprite has no advantage compared with a static graphics image.

Richard.