IonicWind Software

IWBasic => General Questions => Topic started by: Andy on January 21, 2015, 04:50:46 AM

Title: Add a Tabstop to a custom button
Post by: Andy on January 21, 2015, 04:50:46 AM
Hi,

I use Larry's custom button designer to design control buttons.

Does anyone know how to add a @TABSTOP?

To create a normal button in IWB and add a tabstop it's easy:
Control mainscreen,@STATIC,"My Button",40,120,170,35,@TABSTOP,button_1

But with the designer to create a button it doesn't seem to allow this:
CreateCB_LM(mainscreen,"My Button",40,120,170,35,BUTTON_6)

So has anyone managed to add a tabstop to a button created with the custom button designer?

I know Larry is not very well at the moment (and we all wish him a "Get well soon"), anyone know if it can be done?

Thanks,
Andy.
:)

Title: Re: Add a Tabstop to a custom button
Post by: Brian on January 21, 2015, 05:58:12 AM
Andy,

At work at the moment, so can't test, but can't you use the MODIFYSTYLE command?

Brian
Title: Re: Add a Tabstop to a custom button
Post by: Andy on January 21, 2015, 07:25:21 AM
Hi Brian,

Thanks for that, I'm trying it but to no avail at the moment.

Andy.
Title: Re: Add a Tabstop to a custom button
Post by: Brian on January 21, 2015, 09:30:48 AM
Andy, I keep forgetting this command, as long as you're using a WINDOW type

ENABLETABS(win as WINDOW,bEnable as INT)

Any good?

Brian
Title: Re: Add a Tabstop to a custom button
Post by: Andy on January 21, 2015, 10:30:05 AM
Thanks for trying Brian, but that doesn't work either.

Title: Re: Add a Tabstop to a custom button
Post by: LarryMc on January 21, 2015, 10:41:34 AM
Try this
'if mainscreen is a window add this line
ENABLETABS mainscreen, 1

and then  add this
MODIFYSTYLE (mainscreen, @TABSTOP, 0, BUTTON_6)
' Show the changes
REDRAWFRAME (mainscreen, BUTTON_6)

after
CreateCB_LM(mainscreen,"My Button",40,120,170,35,BUTTON_6)

'if mainscreen is a dialog add this
MODIFYSTYLE (mainscreen, @TABSTOP, 0, BUTTON_6)
' Show the changes
REDRAWFRAME (mainscreen, BUTTON_6)

in
select @msg
   case @idinitdialog
      '-->here


Title: Re: Add a Tabstop to a custom button
Post by: Brian on January 22, 2015, 07:50:02 AM
Well, I was on the right track, Andy, both times. Just didn't put them together!

Brian
Title: Re: Add a Tabstop to a custom button
Post by: Andy on January 25, 2015, 06:11:46 AM
Thanks Brian and Larry,

Just taken a few days to try several different ways.

Yes Brian (clever clogs - only joking!), you were right.

In the end I decided to remove the Enambletabs command, and detect and count tab presses to highlight
the appropriate control.

Thanks,
Andy.
Title: Re: Add a Tabstop to a custom button
Post by: LarryMc on January 25, 2015, 11:29:05 PM
It appears my suggested fix above was in error.
The error was not in what I suggest but in the coding of my library.
A portion of my library is based on the structure of IWB's rgnbutton which has its own custom message handler as does the IWB @button and @static controls.  I tested the region button and the @tabstop flag works there in a dialog.  So there is something that is being done in the region button that I am not doing in my custom buttons that I should be doing.  The trick is for me to figure out what it is, how to fix it, and not break something else.

But it should be fixed.
Title: Re: Add a Tabstop to a custom button
Post by: Andy on January 26, 2015, 06:55:03 AM
Larry,

Sorry, I didn't mean to cause you any stress or work.

I could make a test program tab between buttons, but I had to use a count to detect when the custom buttons should have been highlighted.

I also found that if I added a checkbox, I couldn't "move off" the checkbox until I selected or deselected the checkbox, but probably
that was me.

Anyway, as I said, I got around it by removing the Enabletabs command and counted every time the tab key was pressed.

Thanks,
Andy.


Title: Re: Add a Tabstop to a custom button
Post by: LarryMc on January 26, 2015, 08:20:57 AM
Quote from: andy1966 on January 26, 2015, 06:55:03 AM
I didn't mean to cause you any stress or work.
You didn't cause me any stress.
As for work.. you found what I consider a bug in my library and I don't like bugs in my code(if I can fix them) ;)

Besides, after fighting that cold for 3+ weeks I'm beginning to feel like a human being again.
I'll start looking into my code later today.  Have an appt. with my "hand tremors" Dr. in an hour and then some grocery shopping.  Later this week I hope to get my cataract surgery scheduled.
Title: Re: Add a Tabstop to a custom button
Post by: LarryMc on January 28, 2015, 12:20:53 AM
Well, I've look at my library code enough to know it would take a major rewrite to get it it to work properly with the tab key in both windows and dialogs.  Considering that, and the fact that that there aren't that many people using the library , AND, apparently Andy is the only user who has found a need for it and he had found a work around I have made the decision not to spend the time on doing a rewrite to 'fix' the problem.

Instead I will goback to tinkering with the database utility I was playing with.  Sorry if I'm disappointing anyone.
Title: Re: Add a Tabstop to a custom button
Post by: Andy on January 29, 2015, 12:41:43 AM
Hi Larry,

No problem what so ever, it was just one of those little questions that turned something up.

I have attached my work around for anyone who may find it useful.

To use it:

You will need Larry's custom button program installed.

Press <Enter> when a button is highlighted.
Press <Space> when a check box is highlighted.

or simply click the button / checkbox as normal.

Thanks,
Andy.
Title: Re: Add a Tabstop to a custom button
Post by: Egil on January 29, 2015, 04:46:48 AM
Thanks for sharing Andy!

Your workaround can come in handy in many other contexts as well.

As my version of the button library is very old, purchased long before IWB, I changed the file extension to .eba, and compiled it using EB. No buttons though, but the changing text style showed your idea clearly.
Title: Re: Add a Tabstop to a custom button
Post by: Andy on January 29, 2015, 06:48:47 AM
Thanks Egil!

No problem, If I find something of use I always share.

I'm just posting an example of how to add "flat buttons" i.e. buttons without a border.

Please see the "User Offerings" section.

It may help someone.

Thanks,
Andy.
:)