BBC BASIC for Windows
« More buttons »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:27pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: More buttons  (Read 1200 times)
nitwit
Guest
xx More buttons
« Thread started on: May 7th, 2010, 7:24pm »

Having set-up another window and put in a couple of buttons (rectangular pushbuttons), I get no response to a mouse click. (OK in the main window using ON SYS to get a button id% from @wparam%). Using WINLIB5A. Not using dialogue boxes. I've missed something, but what?
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: More buttons
« Reply #1 on: May 7th, 2010, 10:19pm »

on May 7th, 2010, 7:24pm, Guest-nitwit wrote:
Having set-up another window and put in a couple of buttons (rectangular pushbuttons), I get no response to a mouse click.

What do you mean by "set up another window and put in a couple of buttons"? If the 'other window' is a dialogue box you should receive ON SYS events as normal. However if the 'other window' is a child window created using MDILIB or MULTIWIN neither of these forward WM_COMMAND messages to their parent window by default (it would be possible to create customised versions which do).

Is there some reason why you can't put your buttons on a dialogue box?

Richard.
User IP Logged

nitwit
Guest
xx Re: More buttons
« Reply #2 on: May 8th, 2010, 7:52pm »

I'm not using dialogue boxes because they seem to be an added complication. On page 871 of the PDF version of the 'guide' it says you can do without them. And it also says if you use WINLIB5A (which I do) you can put buttons etc in other windows. But not a lot of use if there is no explanation as to how to get a response to a mouse click!
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: More buttons
« Reply #3 on: May 8th, 2010, 9:27pm »

on May 8th, 2010, 7:52pm, Guest-nitwit wrote:
I'm not using dialogue boxes because they seem to be an added complication.

Dialogue boxes almost always make things easier. Certainly a dialogue box is a much better 'host window' for controls like push buttons, because that's how they're principally supposed to work in Windows. You also get 'keyboard navigation' for free, and automatic sizing of controls dependent on DPI value.

Quote:
And it also says if you use WINLIB5A (which I do) you can put buttons etc in other windows. But not a lot of use if there is no explanation as to how to get a response to a mouse click!

You can put controls in other windows but it's non-standard and not encouraged (hence WINLIB5A, the A indicating it's the less common version). With most controls, e.g. list boxes, combo boxes, static controls etc., there's no requirement to forward WM_COMMAND messages to the parent window. It's only pushbuttons that don't work.

As a general rule, if you stick with the Windows GUI 'philosophy' things will be easy and work well. If you break with the Windows GUI philosophy and try to do things your own way it will be harder. Remember the old Windows 95 logo program (if you're old enough!) which would allow applications to use the Windows Logo only if they adopted the standard GUI.

How many applications have you seen that put buttons and other controls on a window other than a dialogue box? I would guess very few. Stick to the standards and you can't go far wrong: your program will end up looking like (and behaving like) a regular Windows application, not something cobbled together like Frankenstein's monster!

Richard.
User IP Logged

nitwit
Guest
xx Re: More buttons
« Reply #4 on: May 17th, 2010, 5:25pm »

I was taught that it didn't matter what the program looks like as long as it did what you wanted.

When you are driving along in your Rolls-Royce you can admire the leather and walnut and listen to the clock but it does not matter what is under the bonnet as long as it does what you want. It could be a Morris Minor engine.

So I can get pushbuttons in other windows and they look as though they act OK. In BBC BASIC the solution lies in MOUSE x%,y%,b% so no problem (and no dialogue box).
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: More buttons
« Reply #5 on: May 17th, 2010, 9:49pm »

on May 17th, 2010, 5:25pm, Guest-nitwit wrote:
I was taught that it didn't matter what the program looks like as long as it did what you wanted.

Whoever taught you that was completely wrong! The most important thing about an OS like Windows is that by providing a uniform user interface many of the common operations are done in a similar way in most applications.

So when a user wants to know how to do something they don't have to read the manual, because they're already familiar with how to do it from other applications.

Quote:
When you are driving along in your Rolls-Royce you can admire the leather and walnut and listen to the clock but it does not matter what is under the bonnet as long as it does what you want. It could be a Morris Minor engine.

Bad analogy. You're not proposing changing the engine, you're proposing swapping the direction indicators with the windscreen wiper controls (I once had to cope with exactly that when I changed my car; these days they're standardised!).

To be specific, your controls won't respond to standard keyboard navigation and shortcuts. Accessibility features, intended to aid those with disabilities, won't work. Your controls won't increase in size when a poorly-sighted user selects 'large fonts'. There are a whole load of things which happen 'under the hood' when you use a dialogue box, which you're probably completely unaware of or have no intention of emulating.

If you're a beginner in Windows programming it's even more important that you do things in the standard way. As you get more experienced you will learn when you can take liberties with the standard GUI and when you can't. You'll also learn how to emulate some of the more subtle features like keyboard navigation if you need to. But to start off with you should do everything 'by the book'.

Richard.
User IP Logged

nitwit
Guest
xx Re: More buttons
« Reply #6 on: Jun 1st, 2010, 10:17am »

I don't really want to learn 'windows' programming. It far too complex and I don't have the time (in any sense). I have 72 (yes I counted them again) programs running quite happily under VirtualAcorn. They use the WIMP and ALL use multiple windows and some use scrolling, files, printing etc etc. However VA or more strictly RISC OS has a couple of major drawbacks. They will never be sorted because there are too few 'developers'. I thought BBC BASIC for Windows might be the answer. Sadly it seems not.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: More buttons
« Reply #7 on: Jun 1st, 2010, 11:45am »

on Jun 1st, 2010, 10:17am, Guest-nitwit wrote:
I don't really want to learn 'windows' programming... I thought BBC BASIC for Windows might be the answer. Sadly it seems not.

There are two main ways to use BBC BASIC for Windows. One is to code in 'portable' BBC BASIC, where all the on-screen graphics etc. are created using native BASIC statements like RECTANGLE and PLOT. Such programs will run largely unmodified on most BBC BASIC platforms, and require effectively zero knowledge of "Windows programming".

The other way to use BBC BASIC for Windows is as a language in which to code Windows GUI applications (rather as you might use Visual Basic, C++, Delphi etc.). Programs written that way will only run under Windows, and inevitably require a good understanding of "Windows programming".

This is no different from RISC OS. You can either write a portable (non-Wimp) BASIC program, or you can write a Wimp-based program. The latter requires a good understanding of RISC OS, and will only run under RISC OS (or an emulation).

If you are trying to convert a RISC OS Wimp-based program to a Windows GUI program you must expect to learn a degree of "Windows programming", just as you needed to learn some "RISC OS programming" in order to write the original.

In fact it's considerably easier to write a Windows GUI program than a RISC OS Wimp program, because Wimp programs need a lot of user code to service things like Wimp Poll. In BBC BASIC for Windows the equivalent overhead is done for you 'in the background'.

If you don't want to learn any "Windows programming" your only option is to code your program in native BBC BASIC graphics. The 'look and feel' won't be much like a genuine Windows program, but that may not matter to you.

Richard.
User IP Logged

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

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls