May 07, 2024, 09:02:03 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Tabs not working

Started by Andy, September 07, 2017, 10:03:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

September 07, 2017, 10:03:08 PM Last Edit: September 07, 2017, 10:11:12 PM by Andy
Well I'm missing something obvious here, but I can't see it.

This bit of code I've put into a file on it's own - when you run it and press the Tab key this is what happens:

Tab 1 gets you to radio 1 ("String" on screen).
Tab 2 gets you to radio 2 ("Dword").
Tab 3 goes to button_1 ("Select") ----- not "Qword"
Tab 4 goes to button_2 ("Cancel")
Tab 5 goes back to "Dword"

Tabbing should just go down the list of radio buttons, then onto the two buttons, and finally go back to the first radio button again.

Help!


istring xx[5000] = ""
istring out[5000] = ""
int outlen = -1
int zerocount = 0
int ReturnCount = 0
int crcount = 0

const Ed1 = 1
const Ed2 = 2
const Ed3 = 3
const Ed4 = 4
const Ed5 = 5
const Ed6 = 6
const Ed7 = 7
const Ed8 = 8
const Ed9 = 9
const Ed10 = 10
const Ed11 = 11
const Ed12 = 12
const Ed13 = 13
const Ed14 = 14
const Ed15 = 15
const Ed16 = 16
const Ed17 = 17
const Ed18 = 18
const Ed19 = 19
const ED20 = 20
const ED21 = 21
const ED22 = 22
const ED23 = 23
const ED24 = 24
const Ed25 = 25
const Ed26 = 26
const Ed27 = 27
const ED28 = 28
const ED29 = 29
const ED30 = 30
const ED31 = 31
const ED32 = 32

CONST EDIT_1  = 101
CONST EDIT_2  = 102

const STATIC_1 = 300
const STATIC_2 = 301
const STATIC_3 = 302
const STATIC_4 = 303
const STATIC_5 = 304
const STATIC_6 = 305
const STATIC_7 = 306
const STATIC_8 = 307
const STATIC_9 = 308

const STATIC_11 = 401
const STATIC_12 = 402
const STATIC_13 = 403
const STATIC_14 = 404
const STATIC_15 = 405
const STATIC_16 = 406
const STATIC_17 = 407
const STATIC_18 = 408

const STATIC_19 = 409
const STATIC_20 = 410
const STATIC_21 = 411
const STATIC_22 = 412
const STATIC_23 = 413
const STATIC_24 = 414
const STATIC_25 = 415
const STATIC_26 = 416

const STATIC_27 = 417
const STATIC_28 = 418
const STATIC_29 = 419
const STATIC_30 = 420
const STATIC_31 = 421
const STATIC_32 = 422
const STATIC_33 = 423
const STATIC_34 = 424

const STATIC_35 = 425
const STATIC_36 = 426
const STATIC_37 = 427
const STATIC_38 = 428
const STATIC_39 = 429
const STATIC_40 = 430
const STATIC_41 = 431
const STATIC_42 = 432

CONST radio_1 = 501
CONST radio_2 = 502
CONST radio_3 = 503
CONST radio_4 = 504
CONST radio_5 = 505
CONST radio_6 = 506
CONST radio_7 = 507

CONST button_1 = 508
CONST button_2 = 509
CONST button_3 = 512
CONST button_4 = 513
CONST button_5 = 514
CONST button_6 = 515
CONST button_7 = 516
CONST button_10 = 517
CONST button_11 = 518
CONST button_12 = 519

DEF w1 as WINDOW
DEF RootKey:string
DEF x,y,z:INT
def yq:int64
DEF result:INT
DEF a1,a2,b1,b2,countup,repop,length:int
DEF t1,t2,t3,t4,t5,t6:string
Def resultin as string
DEF Viewed[10000]:string
DEF Vname[1000]:string
DEF Vtype[1000]:string
DEF Vvalue[1000]:string
DEF ViewCount:int
string PrevView
int AlreadyInsertedValue
int AlreadyInsertedType
int state,EditA,EditB,Created
string resultin2
int SubKeys
string SubKeyName
int Entries,DEntries
string EntryName
int ShowType,Dstate
string bk$ = CHR$(92)
window dy2
window dy3
uint kItem
string fronttext
string endtext
int addpos,NameError
int AlreadyViewed
uint hItem
uint selected
int conf
string EntryDWValue
string EntryDName[5000]
int ConvL
string EntryType = ""

int root1
int child1
int child2
int child3
int child4
int child5
int child10
int child11
int childy
string strText,OrigName
int yloop

int smx,PageNo,EntriesPerPage,CountBytes,CountBytesF,AdVal
int ln,CountLL,val1,val2,backtodec
int Del,DelSave,NoUpdate
string a,Address,b,BV,backsymbol,z$
istring savevalue[10000]
istring savevalueMS[10000]
istring BinEntries[10,10000]
istring hexstring[10,10000]
istring Fhexstring[10,10000]

WINDOW win

UINT TreeBkColor

ViewCount = 0

doWindow()
end

'Sub Routine to select Add a Value type
SUB doWindow(),int
OPENWINDOW dy3,0,0,300,450,@CAPTION|@MINBOX|@MAXBOX|@SIZE|@TOPMOST,0," Select type.",&AddTypeHnd
FLOODFILL dy3,0,0,rgb(0,0,0)

CONTROL dy3,@RADIOBUTTON,"String",80,40,80,25,@CTEDITLEFT|@TABSTOP,RADIO_1
CONTROL dy3,@RADIOBUTTON,"DWord",80,80,80,25,@CTEDITLEFT|@TABSTOP,RADIO_2
CONTROL dy3,@RADIOBUTTON,"QWord",80,120,80,25,@CTEDITLEFT|@TABSTOP,RADIO_3
CONTROL dy3,@RADIOBUTTON,"Binary",80,160,80,25,@CTEDITLEFT|@TABSTOP,RADIO_4
CONTROL dy3,@RADIOBUTTON,"Expandable String",80,200,150,25,@CTEDITLEFT|@TABSTOP,RADIO_5
CONTROL dy3,@RADIOBUTTON,"Multi String",80,240,150,25,@CTEDITLEFT|@TABSTOP,RADIO_6
CONTROL dy3,@RADIOBUTTON,"None",80,280,150,25,@CTEDITLEFT|@TABSTOP,RADIO_7

CONTROL dy3,@BUTTON,"Select",80,350,80,25,@CTEDITLEFT|@TABSTOP,BUTTON_1
CONTROL dy3,@BUTTON,"Cancel",190,350,80,25,@CTEDITLEFT|@TABSTOP,BUTTON_2

SETFONT dy3,"Arial",10,500,0,button_1
SETFONT dy3,"Arial",10,500,0,button_2
SETFONT dy3,"Arial",12,500,0,radio_1
SETFONT dy3,"Arial",12,500,0,radio_2
SETFONT dy3,"Arial",12,500,0,radio_3
SETFONT dy3,"Arial",12,500,0,radio_4
SETFONT dy3,"Arial",12,500,0,radio_5
SETFONT dy3,"Arial",12,500,0,radio_6
SETFONT dy3,"Arial",12,500,0,radio_7

SETCONTROLCOLOR dy3,radio_1,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_2,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_3,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_4,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_5,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_6,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_7,rgb(255,255,102),rgb(0,0,0)

enabletabs dy3,1

SETSTATE dy3,radio_1,1
Dstate = 0
state = 1


'setfocus dy3,radio_1

WAITUNTIL dy3=0

RETURN 0
ENDSUB

SUB AddTypeHnd(),int
SELECT @MESSAGE
CASE @IDCREATE
   CENTERWINDOW dy3

    CASE @IDCONTROL
         SELECT @CONTROLID

            CASE BUTTON_1 'OK
                 if @notifycode = 0
                    closewindow dy3
                    if state = 4
                       'AddNewBin()
                       return 0
                    endif

                    if state = 7
                       'AddNewBin()
                       return 0
                    endif

    'AddValue()

                    return 0
                 endif
         CLOSEWINDOW dy3
            RETURN 0

        CASE BUTTON_2 'Cancel
             if @notifycode = 0
CLOSEWINDOW dy3
RETURN 0
             endif

CASE radio_1 'String
             if @notifycode = 0
SETSTATE dy3,radio_1,1
SETSTATE dy3,radio_2,0
SETSTATE dy3,radio_3,0
SETSTATE dy3,radio_4,0
SETSTATE dy3,radio_5,0
SETSTATE dy3,radio_6,0
SETSTATE dy3,radio_7,0
state = 1
                'setfocus dy3,radio_1
             endif

CASE radio_2 'DWord
             if @notifycode = 0
SETSTATE dy3,radio_1,0
SETSTATE dy3,radio_2,1
SETSTATE dy3,radio_3,0
SETSTATE dy3,radio_4,0
SETSTATE dy3,radio_5,0
SETSTATE dy3,radio_6,0
SETSTATE dy3,radio_7,0
state = 2
                Dstate = 1
                'setfocus dy3,radio_2
             endif

CASE radio_3 'QWord
             if @notifycode = 0
SETSTATE dy3,radio_1,0
SETSTATE dy3,radio_2,0
SETSTATE dy3,radio_3,1
SETSTATE dy3,radio_4,0
SETSTATE dy3,radio_5,0
SETSTATE dy3,radio_6,0
SETSTATE dy3,radio_7,0
state = 3
                Dstate = 2
                'setfocus dy3,radio_3
             endif

CASE radio_4 'Binary
             if @notifycode = 0
SETSTATE dy3,radio_1,0
SETSTATE dy3,radio_2,0
SETSTATE dy3,radio_3,0
SETSTATE dy3,radio_4,1
SETSTATE dy3,radio_5,0
SETSTATE dy3,radio_6,0
SETSTATE dy3,radio_7,0
state = 4
                'setfocus dy3,radio_4
             endif

CASE radio_5 'Expandable String
             if @notifycode = 0
SETSTATE dy3,radio_1,0
SETSTATE dy3,radio_2,0
SETSTATE dy3,radio_3,0
SETSTATE dy3,radio_4,0
SETSTATE dy3,radio_5,1
SETSTATE dy3,radio_6,0
SETSTATE dy3,radio_7,0
state = 5
                'setfocus dy3,radio_5
             endif

CASE radio_6 'Multi String
             if @notifycode = 0
SETSTATE dy3,radio_1,0
SETSTATE dy3,radio_2,0
SETSTATE dy3,radio_3,0
SETSTATE dy3,radio_4,0
SETSTATE dy3,radio_5,0
SETSTATE dy3,radio_6,1
SETSTATE dy3,radio_7,0
state = 6
                'setfocus dy3,radio_6
             endif

CASE radio_7 'None
             if @notifycode = 0
SETSTATE dy3,radio_1,0
SETSTATE dy3,radio_2,0
SETSTATE dy3,radio_3,0
SETSTATE dy3,radio_4,0
SETSTATE dy3,radio_5,0
SETSTATE dy3,radio_6,0
SETSTATE dy3,radio_7,1
state = 7
                'setfocus dy3,radio_7
             endif

        ENDSELECT

CASE @IDCLOSEWINDOW
           CLOSEWINDOW dy3
           RETURN 0
   
ENDSELECT
RETURN 0
ENDSUB


 
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

September 07, 2017, 10:31:18 PM #1 Last Edit: September 07, 2017, 10:48:43 PM by Andy
I was setting the state of all the other radio buttons to zero, this knocked out the tabbing - I've removed that and tabbing is working - but I'm still not tabbing all the way round the controls.




Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

billhsln

September 07, 2017, 11:00:00 PM #2 Last Edit: September 07, 2017, 11:06:31 PM by billhsln
You might want to take a look at a groupbox, would remove all the logic you have for the radio buttons and handle keeping only one active.  As long as the radio buttons are within the groupbox.

I set this up and did not have to worry about turning off the ones I had not clicked on.

CONTROL w4,@GROUPBOX,"Character Type",20,40,160,290,0x50000007,W4_G1
CONTROL w4,@RADIOBUTTON,"Grass",30,60,120,20,@TABSTOP|@GROUP,W4_B01
CONTROL w4,@RADIOBUTTON,"Fire",30,80,120,22,@TABSTOP,W4_B02
CONTROL w4,@RADIOBUTTON,"Water",30,100,120,20,@TABSTOP,W4_B03
CONTROL w4,@RADIOBUTTON,"Lightning",30,120,120,20,@TABSTOP,W4_B04
CONTROL w4,@RADIOBUTTON,"Psychic",30,140,120,20,@TABSTOP,W4_B05
CONTROL w4,@RADIOBUTTON,"Fighting",30,160,120,20,@TABSTOP,W4_B06
CONTROL w4,@RADIOBUTTON,"Darkness",30,180,120,20,@TABSTOP,W4_B07
CONTROL w4,@RADIOBUTTON,"Metal",30,200,120,20,@TABSTOP,W4_B08
CONTROL w4,@RADIOBUTTON,"Dragon",30,220,120,20,@TABSTOP,W4_B10
CONTROL w4,@RADIOBUTTON,"Colorless",30,240,120,20,@TABSTOP,W4_B09
CONTROL w4,@RADIOBUTTON,"None",30,260,120,20,@TABSTOP,W4_B01N
CONTROL w4,@RADIOBUTTON,"Supporter",30,280,120,20,@TABSTOP,W4_B01S
CONTROL w4,@RADIOBUTTON,"Trainer",30,300,120,20,@TABSTOP,W4_B02S
CONTROL w4,@RADIOBUTTON,"Stadium",30,320,120,20,@TABSTOP,W4_B03S


Bill
When all else fails, get a bigger hammer.

Andy

September 07, 2017, 11:21:53 PM #3 Last Edit: September 07, 2017, 11:24:19 PM by Andy
Thanks Bill, I may have to look into that.

This is what I've got now - it tabs down to the bottom radio button - but I can't get it to tab back to the first one yet.


istring xx[5000] = ""
istring out[5000] = ""
int outlen = -1
int zerocount = 0
int ReturnCount = 0
int crcount = 0

const Ed1 = 1
const Ed2 = 2
const Ed3 = 3
const Ed4 = 4
const Ed5 = 5
const Ed6 = 6
const Ed7 = 7
const Ed8 = 8
const Ed9 = 9
const Ed10 = 10
const Ed11 = 11
const Ed12 = 12
const Ed13 = 13
const Ed14 = 14
const Ed15 = 15
const Ed16 = 16
const Ed17 = 17
const Ed18 = 18
const Ed19 = 19
const ED20 = 20
const ED21 = 21
const ED22 = 22
const ED23 = 23
const ED24 = 24
const Ed25 = 25
const Ed26 = 26
const Ed27 = 27
const ED28 = 28
const ED29 = 29
const ED30 = 30
const ED31 = 31
const ED32 = 32

CONST EDIT_1  = 101
CONST EDIT_2  = 102

const STATIC_1 = 300
const STATIC_2 = 301
const STATIC_3 = 302
const STATIC_4 = 303
const STATIC_5 = 304
const STATIC_6 = 305
const STATIC_7 = 306
const STATIC_8 = 307
const STATIC_9 = 308

const STATIC_11 = 401
const STATIC_12 = 402
const STATIC_13 = 403
const STATIC_14 = 404
const STATIC_15 = 405
const STATIC_16 = 406
const STATIC_17 = 407
const STATIC_18 = 408

const STATIC_19 = 409
const STATIC_20 = 410
const STATIC_21 = 411
const STATIC_22 = 412
const STATIC_23 = 413
const STATIC_24 = 414
const STATIC_25 = 415
const STATIC_26 = 416

const STATIC_27 = 417
const STATIC_28 = 418
const STATIC_29 = 419
const STATIC_30 = 420
const STATIC_31 = 421
const STATIC_32 = 422
const STATIC_33 = 423
const STATIC_34 = 424

const STATIC_35 = 425
const STATIC_36 = 426
const STATIC_37 = 427
const STATIC_38 = 428
const STATIC_39 = 429
const STATIC_40 = 430
const STATIC_41 = 431
const STATIC_42 = 432

CONST radio_1 = 501
CONST radio_2 = 502
CONST radio_3 = 503
CONST radio_4 = 504
CONST radio_5 = 505
CONST radio_6 = 506
CONST radio_7 = 507
CONST radio_7 = 507

CONST button_1 = 508
CONST button_2 = 509
CONST button_3 = 512
CONST button_4 = 513
CONST button_5 = 514
CONST button_6 = 515
CONST button_7 = 516
CONST button_10 = 517
CONST button_11 = 518
CONST button_12 = 519

DEF w1 as WINDOW
DEF RootKey:string
DEF x,y,z:INT
def yq:int64
DEF result:INT
DEF a1,a2,b1,b2,countup,repop,length:int
DEF t1,t2,t3,t4,t5,t6:string
Def resultin as string
DEF Viewed[10000]:string
DEF Vname[1000]:string
DEF Vtype[1000]:string
DEF Vvalue[1000]:string
DEF ViewCount:int
string PrevView
int AlreadyInsertedValue
int AlreadyInsertedType
int state,EditA,EditB,Created
string resultin2
int SubKeys
string SubKeyName
int Entries,DEntries
string EntryName
int ShowType,Dstate
string bk$ = CHR$(92)
window dy2
window dy3
uint kItem
string fronttext
string endtext
int addpos,NameError
int AlreadyViewed
uint hItem
uint selected
int conf
string EntryDWValue
string EntryDName[5000]
int ConvL
string EntryType = ""

int root1
int child1
int child2
int child3
int child4
int child5
int child10
int child11
int childy
string strText,OrigName
int yloop

int smx,PageNo,EntriesPerPage,CountBytes,CountBytesF,AdVal
int ln,CountLL,val1,val2,backtodec
int Del,DelSave,NoUpdate
string a,Address,b,BV,backsymbol,z$
istring savevalue[10000]
istring savevalueMS[10000]
istring BinEntries[10,10000]
istring hexstring[10,10000]
istring Fhexstring[10,10000]

WINDOW win

UINT TreeBkColor

ViewCount = 0

doWindow()
end

'Sub Routine to select Add a Value type
SUB doWindow(),int
OPENWINDOW dy3,0,0,300,450,@MINBOX|@MAXBOX|@SIZE|@TOPMOST,0," Select type.",&AddTypeHnd
FLOODFILL dy3,0,0,rgb(0,0,0)

CONTROL dy3,@RADIOBUTTON,"String",80,40,80,25,@CTEDITLEFT|@TABSTOP,RADIO_1
CONTROL dy3,@RADIOBUTTON,"DWord",80,80,80,25,@CTEDITLEFT|@TABSTOP,RADIO_2
CONTROL dy3,@RADIOBUTTON,"QWord",80,120,80,25,@CTEDITLEFT|@TABSTOP,RADIO_3
CONTROL dy3,@RADIOBUTTON,"Binary",80,160,80,25,@CTEDITLEFT|@TABSTOP,RADIO_4
CONTROL dy3,@RADIOBUTTON,"Expandable String",80,200,150,25,@CTEDITLEFT|@TABSTOP,RADIO_5
CONTROL dy3,@RADIOBUTTON,"Multi String",80,240,150,25,@CTEDITLEFT|@TABSTOP,RADIO_6
CONTROL dy3,@RADIOBUTTON,"None",80,280,150,25,@CTEDITLEFT|@TABSTOP,RADIO_7

CONTROL dy3,@BUTTON,"Select",80,350,80,25,@CTEDITLEFT,BUTTON_1
CONTROL dy3,@BUTTON,"Cancel",190,350,80,25,@CTEDITLEFT,BUTTON_2

SETFONT dy3,"Arial",10,500,0,button_1
SETFONT dy3,"Arial",10,500,0,button_2
SETFONT dy3,"Arial",12,500,0,radio_1
SETFONT dy3,"Arial",12,500,0,radio_2
SETFONT dy3,"Arial",12,500,0,radio_3
SETFONT dy3,"Arial",12,500,0,radio_4
SETFONT dy3,"Arial",12,500,0,radio_5
SETFONT dy3,"Arial",12,500,0,radio_6
SETFONT dy3,"Arial",12,500,0,radio_7

SETCONTROLCOLOR dy3,radio_1,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_2,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_3,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_4,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_5,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_6,rgb(255,255,102),rgb(0,0,0)
SETCONTROLCOLOR dy3,radio_7,rgb(255,255,102),rgb(0,0,0)

enabletabs dy3,1

SETSTATE dy3,radio_1,1
'Dstate = 0
'state = 1


'setfocus dy3,radio_1

WAITUNTIL dy3=0

RETURN 0
ENDSUB

SUB AddTypeHnd(),int
SELECT @MESSAGE
CASE @IDCREATE
   CENTERWINDOW dy3

    CASE @IDCONTROL
         SELECT @CONTROLID

            CASE BUTTON_1 'OK
                 if @notifycode = 0
                    closewindow dy3
                    if state = 4
                       'AddNewBin()
                       return 0
                    endif

                    if state = 7
                       'AddNewBin()
                       return 0
                    endif

    'AddValue()

                    return 0
                 endif
         CLOSEWINDOW dy3
            RETURN 0

        CASE BUTTON_2 'Cancel
             if @notifycode = 0
CLOSEWINDOW dy3
RETURN 0
             endif

CASE radio_1 'String
SETSTATE dy3,radio_1,1
'SETSTATE dy3,radio_7,0
'state = 1

CASE radio_2 'DWord

SETSTATE dy3,radio_2,1
SETSTATE dy3,radio_1,0

'state = 2
                'Dstate = 1
                'setfocus dy3,radio_2

CASE radio_3 'QWord

SETSTATE dy3,radio_3,1
SETSTATE dy3,radio_2,0
'state = 3
                'Dstate = 2

CASE radio_4 'Binary
SETSTATE dy3,radio_4,1
SETSTATE dy3,radio_3,0
state = 4
                'setfocus dy3,radio_4

CASE radio_5 'Expandable String
SETSTATE dy3,radio_5,1
SETSTATE dy3,radio_4,0
state = 5
                'setfocus dy3,radio_5

CASE radio_6 'Multi String
SETSTATE dy3,radio_6,1
SETSTATE dy3,radio_5,0
state = 6
                'setfocus dy3,radio_6

CASE radio_7 'None
SETSTATE dy3,radio_7,1
SETSTATE dy3,radio_6,0
state = 7
                'setfocus dy3,radio_7

        ENDSELECT

CASE @IDCLOSEWINDOW
           CLOSEWINDOW dy3
           RETURN 0
   
ENDSELECT
RETURN 0
ENDSUB

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Just changed the radio buttons to check boxes and it work fine.....
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.