SINCE NO THREADS EXIST ABOUT WINDTAB

GFA BASIC-related articles in here please

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 1984
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

SINCE NO THREADS EXIST ABOUT WINDTAB

Postby charles » Mon Sep 18, 2017 1:03 am

WHY DOES THIS LISTING RUN FINE ONCE IN THE EDITOR THEN WHEN NO EDITS MADE NOT EXECUTE A SECONF TIME

IS IT THE WINDTABS FAULT .....OR MINE ,,,LOL?

Code: Select all

SAVE "b:\fentre2.gfa"
LIST "b:\fentre2.lst"
KILL "*.BAK"
'
DEFINT "a-z"
'
DIM buffer&(7)  ! buffer for 8 messages (evnt_mesag)
DIM opened(1)
'
'  Initialize table:
'
WINDTAB(1,1)=&X111111    ! attributes
WINDTAB(1,2)=20    ! coords window 1
WINDTAB(1,3)=20
WINDTAB(1,4)=200
WINDTAB(1,5)=120
'
WINDTAB(2,1)=&X111111    !attributes
WINDTAB(2,2)=50    ! coords window 2
WINDTAB(2,3)=50
WINDTAB(2,4)=200
WINDTAB(2,5)=120
'
ap_id=APPL_INIT()
'
'  Detect desktop size (work area)
VOID WIND_GET(0,4,x_desk,y_desk,w_desk,h_desk)
WORD{WINDTAB+52}=x_desk
WORD{WINDTAB+54}=y_desk
WORD{WINDTAB+56}=w_desk
WORD{WINDTAB+58}=h_desk
'
'
IF FN create_windows
  VOID FORM_ALERT(1,"[3][Its not possible | window id handle failure!][OK]")
ELSE
  '
  ' Parameter lines for title and info:
  '
  t1$="Window 1"+CHR$(0)
  i1$="Just a note:"+CHR$(0)
  '
  t2$="Window 2"+CHR$(0)
  i2$="Just another note:"+CHR$(0)
  '
  ' next command likes a value stored in a Low and High ( DIV 2^16 et MOD 2^16)
  ' title: function# 2
  ' info:  function# 3
  '
  VOID WIND_SET(WINDTAB(1,0),2,WORD(SWAP(V:t1$)),WORD(V:t1$),0,0)
  VOID WIND_SET(WINDTAB(1,0),3,WORD(SWAP(V:i1$)),WORD(V:i1$),0,0)
  VOID WIND_SET(WINDTAB(2,0),2,WORD(SWAP(V:t2$)),WORD(V:t2$),0,0)
  VOID WIND_SET(WINDTAB(2,0),3,WORD(SWAP(V:i2$)),WORD(V:i2$),0,0)
  '
  ' open windows:
  '
  FOR i=0 TO 1
    VOID WIND_OPEN(WINDTAB(i+1,0),WINDTAB(i+1,2),WINDTAB(i+1,3),WINDTAB(i+1,4),WINDTAB(i+1,5))
    opened(i)=1
    output_text(i)
  NEXT i
  '
  REPEAT
    ' Event message:
    VOID EVNT_MESAG(V:buffer&(0))
    '
    w=0
    WHILE NOT (buffer&(3)=WINDTAB(w+1,0) OR w=2)
      PRINT w
      INC w
    WEND
    '
    IF window<2                    ! Which window (1 ou 2)?
      '
      IF buffer&(0)=20             ! Message Redraw
        GOSUB redraw(w)
        '
      ELSE IF buffer&(0)=21        ! Window-Topped
        VOID WIND_SET(WINDTAB(w+1,0),10,0,0,0,0)
        '
      ELSE IF buffer&(0)=23        ! La boŒte plein ‚cran a ‚t‚ cliqu‚e
        WINDTAB(w+1,2)=WORD{WINDTAB+52}+2             ! Amener la window … sa taille maximale
        WINDTAB(w+1,3)=WORD{WINDTAB+54}+2
        WINDTAB(w+1,4)=WORD{WINDTAB+56}-6
        WINDTAB(w+1,5)=WORD{WINDTAB+58}-6
        VOID WIND_SET(WINDTAB(w+1,0),5,WINDTAB(w+1,2),WINDTAB(w+1,3),WINDTAB(w+1,4),WINDTAB(w+1,5))
        '
      ELSE IF buffer&(0)=27        ! BoŒte de taille
        WINDTAB(w+1,4)=buffer&(6)           ! Lire la taille dans le message
        WINDTAB(w+1,5)=buffer&(7)
        VOID WIND_SET(WINDTAB(w+1,0),5,WINDTAB(w+1,2),WINDTAB(w+1,3),WINDTAB(w+1,4),WINDTAB(w+1,5))
        '
      ELSE IF buffer&(0)=28        ! BoŒte de d‚placement
        WINDTAB(w+1,2)=buffer&(4)           ! x et y sont inchang‚s
        WINDTAB(w+1,3)=buffer&(5)
        VOID WIND_SET(WINDTAB(w+1,0),5,WINDTAB(w+1,2),WINDTAB(w+1,3),WINDTAB(w+1,4),WINDTAB(w+1,5))
        '
      ELSE IF buffer&(0)=22        ! BoŒte de fermeture
        VOID WIND_CLOSE(WINDTAB(w+1,0))
        VOID WIND_DELETE(WINDTAB(w+1,0))
        opened(w)=0
      ENDIF
      '
    ENDIF
    '
  UNTIL NOT ((opened(0)=1) OR (opened(1)=1))
  '
ENDIF
'
VOID APPL_EXIT()
'
END
'
'
'
> PROCEDURE output_text(w)
  '
  ' Afficher le contenu de la window
  ' dŠs le lancement du programme
  ' Passer la taille de la zone de travail:
  '
  VOID WIND_CALC(1,WINDTAB(w+1,1),WINDTAB(w+1,2),WINDTAB(w+1,3),WINDTAB(w+1,4),WINDTAB(w+1,5),x,y,w,h)
  '
  x2=x+w-1
  y2=y+h-1
  CLIP x,y TO x2,y2
  '
  draw_text(x,y,x2,y2,x,y)
  '
  CLIP OFF
  '
RETURN
'
> PROCEDURE draw_text(x1,y1,x2,y2,x,y)
  ' Parameter:
  '    x1,y1,x2,y1 est le rectangle qui doit ˆtre redessin‚,
  '   donc effac‚. x,y est l'angle sup‚rieur gauche du texte.
  '   x,y ne sont pas forc‚ment identiques … x1,y1 !!!  '
  '
  ' D‚sactiver la souris, qui ne sert qu'… nous gˆner  '
  '
  HIDEM
  '
  ' Effacer la zone de travail:
  BOUNDARY 0
  DEFFILL 0
  PBOX x1,y1,x2,y2
  BOUNDARY 1
  '
  '  Text:  '
  TEXT x+8,y+14,"Hello! This is a Atari window!"
  TEXT x+8,y+30,"A moveable ,resizable window."
  TEXT x+8,y+46,"Quit: Window closer!"
  '
  SHOWM
  '
RETURN
'
> FUNCTION create_windows
'
FOR i=0 TO 1
  WINDTAB(i+1,0)=WIND_CREATE(WINDTAB(i+1,1),WORD{WINDTAB+52},WORD{WINDTAB+54},WORD{WINDTAB+56},WORD{WINDTAB+58})
NEXT i
'
RETURN (WINDTAB(1,0)<0) AND (WINDTAB(2,0)<0)
'
ENDFUNC
'
> PROCEDURE redraw(w)
' Recalculate work space:
'
VOID WIND_CALC(1,WINDTAB(w+1,1),WINDTAB(w+1,2),WINDTAB(w+1,3),WINDTAB(w+1,4),WINDTAB(w+1,5),ax,ay,aw,ah)
VOID WIND_UPDATE(1)
'
VOID WIND_GET(WINDTAB(w+1,0),11,rx,ry,rw,rh)  ! 11->premier rectangle  '
'
WHILE rw>0                         ! tant que le rectangle a une largeur
  IF RC_INTERSECT(buffer&(4),buffer&(5),buffer&(6),buffer&(7),rx,ry,rw,rh)
    rx2=rx+rw-1
    ry2=ry+rh-1
    CLIP rx,ry TO rx2,ry2
    GOSUB draw_text(rx,ry,rx2,ry2,ax,ay)
  ENDIF
  VOID WIND_GET(WINDTAB(w+1,0),12,rx,ry,rw,rh) ! 12->rectangle suivant
WEND
'
CLIP OFF
'
VOID WIND_UPDATE(0)
'
RETURN
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 1984
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: SINCE NO THREADS EXIST ABOUT WINDTAB

Postby charles » Mon Sep 18, 2017 1:40 am

BUT if I change the gfa command WINDTAB to an array wintab&(x,x)
it has changed and can be run over and over with out freezing gfa .....

is this because windtab might be connected to the GB intout and this address is changing within gfa?

Code: Select all

SAVE "b:\fentre3.gfa"
LIST "b:\fentre3.lst"
KILL "*.BAK"
'
DEFINT "a-z"
'
DIM buffer&(7)  ! buffer for 8 messages (evnt_mesag)
DIM opened(1)
DIM wintab&(4,33)
'
'  Initialize table:
'
wintab&(1,1)=&X111111    ! attributes
wintab&(1,2)=20    ! coords window 1
wintab&(1,3)=20
wintab&(1,4)=200
wintab&(1,5)=120
'
wintab&(2,1)=&X111111    !attributes
wintab&(2,2)=50    ! coords window 2
wintab&(2,3)=50
wintab&(2,4)=200
wintab&(2,5)=120
'
ap_id=APPL_INIT()
'
'  Detect desktop size (work area)
VOID WIND_GET(0,4,wintab&(0,26),wintab&(0,27),wintab&(0,28),wintab&(0,29))
'
'
IF FN create_windows
  VOID FORM_ALERT(1,"[3][Its not possible | window id handle failure!][OK]")
ELSE
  '
  ' Parameter lines for title and info:
  '
  t1$="Window 1"+CHR$(0)
  i1$="Just a note:"+CHR$(0)
  '
  t2$="Window 2"+CHR$(0)
  i2$="Just another note:"+CHR$(0)
  '
  ' next command likes a value stored in a Low and High ( DIV 2^16 et MOD 2^16)
  ' title: function# 2
  ' info:  function# 3
  '
  VOID WIND_SET(wintab&(1,0),2,WORD(SWAP(V:t1$)),WORD(V:t1$),0,0)
  VOID WIND_SET(wintab&(1,0),3,WORD(SWAP(V:i1$)),WORD(V:i1$),0,0)
  VOID WIND_SET(wintab&(2,0),2,WORD(SWAP(V:t2$)),WORD(V:t2$),0,0)
  VOID WIND_SET(wintab&(2,0),3,WORD(SWAP(V:i2$)),WORD(V:i2$),0,0)
  '
  ' open windows:
  '
  FOR i=0 TO 1
    VOID WIND_OPEN(wintab&(i+1,0),wintab&(i+1,2),wintab&(i+1,3),wintab&(i+1,4),wintab&(i+1,5))
    opened(i)=1
    output_text(i)
  NEXT i
  '
  REPEAT
    ' Event message:
    VOID EVNT_MESAG(V:buffer&(0))
    '
    w=0
    WHILE NOT (buffer&(3)=wintab&(w+1,0) OR w=2)
      PRINT w
      INC w
    WEND
    '
    IF window<2                    ! Which window (1 ou 2)?
      '
      IF buffer&(0)=20             ! Message Redraw
        GOSUB redraw(w)
        '
      ELSE IF buffer&(0)=21        ! Window-Topped
        VOID WIND_SET(wintab&(w+1,0),10,0,0,0,0)
        '
      ELSE IF buffer&(0)=23        ! La boŒte plein ‚cran a ‚t‚ cliqu‚e
        wintab&(w+1,2)=wintab&(0,26)+2             ! Amener la window … sa taille maximale
        wintab&(w+1,3)=wintab&(0,27)+2
        wintab&(w+1,4)=wintab&(0,28)-6
        wintab&(w+1,5)=wintab&(0,29)-6
        VOID WIND_SET(wintab&(w+1,0),5,wintab&(w+1,2),wintab&(w+1,3),wintab&(w+1,4),wintab&(w+1,5))
        '
      ELSE IF buffer&(0)=27        ! BoŒte de taille
        wintab&(w+1,4)=buffer&(6)           ! Lire la taille dans le message
        wintab&(w+1,5)=buffer&(7)
        VOID WIND_SET(wintab&(w+1,0),5,wintab&(w+1,2),wintab&(w+1,3),wintab&(w+1,4),wintab&(w+1,5))
        '
      ELSE IF buffer&(0)=28        ! BoŒte de d‚placement
        wintab&(w+1,2)=buffer&(4)           ! x et y sont inchang‚s
        wintab&(w+1,3)=buffer&(5)
        VOID WIND_SET(wintab&(w+1,0),5,wintab&(w+1,2),wintab&(w+1,3),wintab&(w+1,4),wintab&(w+1,5))
        '
      ELSE IF buffer&(0)=22        ! BoŒte de fermeture
        VOID WIND_CLOSE(wintab&(w+1,0))
        VOID WIND_DELETE(wintab&(w+1,0))
        opened(w)=0
      ENDIF
      '
    ENDIF
    '
  UNTIL NOT ((opened(0)=1) OR (opened(1)=1))
  '
ENDIF
'
VOID APPL_EXIT()
'
END
'
'
'
PROCEDURE output_text(w)
  '
  ' Afficher le contenu de la window
  ' dŠs le lancement du programme
  ' Passer la taille de la zone de travail:
  '
  VOID WIND_CALC(1,wintab&(w+1,1),wintab&(w+1,2),wintab&(w+1,3),wintab&(w+1,4),wintab&(w+1,5),x,y,w,h)
  '
  x2=x+w-1
  y2=y+h-1
  CLIP x,y TO x2,y2
  '
  draw_text(x,y,x2,y2,x,y)
  '
  CLIP OFF
  '
RETURN
'
PROCEDURE draw_text(x1,y1,x2,y2,x,y)
  ' Parameter:
  '    x1,y1,x2,y1 est le rectangle qui doit ˆtre redessin‚,
  '   donc effac‚. x,y est l'angle sup‚rieur gauche du texte.
  '   x,y ne sont pas forc‚ment identiques … x1,y1 !!!  '
  '
  ' D‚sactiver la souris, qui ne sert qu'… nous gˆner  '
  '
  HIDEM
  '
  ' Effacer la zone de travail:
  BOUNDARY 0
  DEFFILL 0
  PBOX x1,y1,x2,y2
  BOUNDARY 1
  '
  '  Text:  '
  TEXT x+8,y+14,"Hello! This is a Atari window!"
  TEXT x+8,y+30,"A moveable ,resizable window."
  TEXT x+8,y+46,"Quit: Window closer!"
  '
  SHOWM
  '
RETURN
'
FUNCTION create_windows
  '
  FOR i=0 TO 1
    wintab&(i+1,0)=WIND_CREATE(wintab&(i+1,1),wintab&(0,26),wintab&(0,27),wintab&(0,28),wintab&(0,29))
  NEXT i
  '
  RETURN (wintab&(1,0)<0) AND (wintab&(2,0)<0)
  '
ENDFUNC
'
PROCEDURE redraw(w)
  ' Recalculate work space:
  '
  VOID WIND_CALC(1,wintab&(w+1,1),wintab&(w+1,2),wintab&(w+1,3),wintab&(w+1,4),wintab&(w+1,5),ax,ay,aw,ah)
  VOID WIND_UPDATE(1)
  '
  VOID WIND_GET(wintab&(w+1,0),11,rx,ry,rw,rh)  ! 11->premier rectangle  '
  '
  WHILE rw>0                         ! tant que le rectangle a une largeur
    IF RC_INTERSECT(buffer&(4),buffer&(5),buffer&(6),buffer&(7),rx,ry,rw,rh)
      rx2=rx+rw-1
      ry2=ry+rh-1
      CLIP rx,ry TO rx2,ry2
      GOSUB draw_text(rx,ry,rx2,ry2,ax,ay)
    ENDIF
    VOID WIND_GET(wintab&(w+1,0),12,rx,ry,rw,rh) ! 12->rectangle suivant
  WEND
  '
  CLIP OFF
  '
  VOID WIND_UPDATE(0)
  '
RETURN
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!


Social Media

     

Return to “GFA BASIC”

Who is online

Users browsing this forum: No registered users and 1 guest