BBC BASIC for Windows
« Tool Button States »

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



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: Tool Button States  (Read 974 times)
Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Tool Button States
« Thread started on: Oct 12th, 2014, 3:04pm »

Hi,

In the BB4W help some of the the tool button states are listed as:

0 Disabled
4 Enabled
6 Pressed
8 Hidden

The bottom three are from a combination of the Window's constants:

TBSTATE_ENABLED = 4
TBSTATE_PRESSED = 2
TBSTATE_HIDDEN = 8

But neither the MSDN or WINCONSTANT suggests what the constant label is for 'Disabled'. I've tried various combination of words (e.g. TBSTATE_DISABLED), but apart from adding to my own contant table TBSTATE_DISABLED = 0, I can't figure out if there's supposed to be a Window's constant for it. Any ideas?

Matt
User IP Logged

rtr2
Guest
xx Re: Tool Button States
« Reply #1 on: Oct 12th, 2014, 5:30pm »

on Oct 12th, 2014, 3:04pm, Matt wrote:
I can't figure out if there's supposed to be a Windows constant for it.

No, there isn't - 'disabled' is simply 'not enabled'.

Richard.
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Tool Button States
« Reply #2 on: Oct 12th, 2014, 6:50pm »

on Oct 12th, 2014, 5:30pm, g4bau wrote:
No, there isn't - 'disabled' is simply 'not enabled'.

OK. That's interesting.

Would the normal routine, then, be to get the state first (e.g.):

SYS "SendMessage", HTool%, TB_GETSTATE, Butt%, 0 TO state%
SYS "SendMessage", HTool%, TB_SETSTATE, Butt%, state% AND NOT TBSTATE_ENABLED

rather than arbitrarily setting the state? (e.g.):

SYS "SendMessage", HTool%, TB_SETSTATE, Butt%, TBSTATE_ENABLED

Matt
User IP Logged

rtr2
Guest
xx Re: Tool Button States
« Reply #3 on: Oct 12th, 2014, 8:23pm »

on Oct 12th, 2014, 6:50pm, Matt wrote:
Would the normal routine, then, be to get the state first ... rather than arbitrarily setting the state?

I've no idea what is "normal" since I've not studied other people's code. I can only say what is obviously the case: the only time one would need to use the read-modify-write procedure is if it is necessary to change the state of one (or more) bits whilst preserving the remaining bits in an unchanged - but unknown - state.

To me that sounds like an uncommon requirement. In a typical application most of the state bits will be pre-defined and remain unchanged. For example you would be very unlikely to want to change the TBSTATE_ELLIPSIS or TBSTATE_WRAP bits dynamically, so going to the trouble of reading the state first just to ensure those bits are unaltered is extra work, you might just as well set the required bits every time.

But in a situation when you do need to preserve the state of a bit that you don't know (for example disable a button without altering its 'pressed' state) then the procedure you describe is the way to do it.

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