BBC BASIC
Programming >> User Interface >> Moveable Tabs
http://bbcbasic.conforums.com/index.cgi?board=ui&action=display&num=1518724357

Moveable Tabs
Post by KenDown on Feb 15th, 2018, 6:52pm

I have created some tabs, following the method given in the Wiki. This appears to create a perfectly normal window which contains the tabs.

I would like to toggle the position of the tabs by clicking on a menu item, and thought that a simple SYS"SetWindowPos" using the handle returned by the tab creation routine would do the job, but the tabs remain stubbornly in place.

Can tabs be moved? Is SetWindowPos the right way to do it? Advice gratefully received.
Re: Moveable Tabs
Post by Richard Russell on Feb 15th, 2018, 8:15pm

on Feb 15th, 2018, 6:52pm, KenDown wrote:
I have created some tabs, following the method given in the Wiki.

Unfortunately the term "tab" can mean different things. For example a 'tab' can mean a 'tab stop': a column in (for example) an edit control or a list box at which things are aligned. A 'tab' can also mean a 'tab control', which is analogous to the dividers in a notebook or the labels in a file cabinet.

I cannot tell from your message which kind of "tab" you are talking about, and although you refer to "the method given in the Wiki" there is no link which would provide the answer. Please clarify.

Richard.
Re: Moveable Tabs
Post by KenDown on Feb 15th, 2018, 8:45pm

Sorry. It's the "tab control"
http://bb4w.wikispaces.com/Creating+a+tab+control

I have three tabs set and, depending on user input, I want to move all three a certain distance to the left or back again to the original position.
Re: Moveable Tabs
Post by Richard Russell on Feb 16th, 2018, 02:33am

on Feb 15th, 2018, 8:45pm, KenDown wrote:
I want to move all three a certain distance to the left or back again to the original position.

If you've tried the 'obvious' ways and they don't work, that probably means you can't. But you might want to check that you really are using window handles: the BB4W libraries are rather inconsistent in how you find the window handle of a control (for example WINLIB5 returns window handles directly, but WINLIB2 doesn't).

Richard.


Re: Moveable Tabs
Post by KenDown on Feb 16th, 2018, 08:48am

Thanks - that point about WINLIB2 and 5 was something I hadn't realised before!

Actually, after a night's sleep I looked at it again and discovered that I had left off a "0," and once that was in, it all worked properly. Sorry to have troubled you.

So for the record, you *can* move tab controls around (and the associated dialog boxes - if any - move with them) using "SetWindowPos" and the handle returned by the creation routine. However if you want to vary the number of tabs, you have to close the window and recreate it with the required number of tabs.