1. Making UDT's using Sequence?

I have tried to convert this small bit of code I wrote last year using
RapidQ into
Euphoria, but I'm still having problems understanding the Sequence idea.

*  I don't understand how to make a Sequence like a User Defined Type. 
*  Can't get the Data files to load either...
*  My programming experience is limited to QuickBasic and RapidQ. 

Listed below is part of the Euphoria code I have been trying to get to work.  
I also included parts of the RQ code to show what I'm trying to do...
It's much easier to make Windows using Euphoria over RQ but working with UDT's
is alot easier... (hint, hint to the win32lib staff :)

HELP is very much appreciated. 

-------------------------- BEGIN EUPHORIA CODE
-------------------------------------
include Win32Lib.ew
        without warning

integer fn

sequence fName, game
         fName = "gamestat.dat"
         game = { 0,{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, " ", " ", " ", 0 }

fn = open(fName, "r" )
     game[1] = getc(fn)
     game[2][1] = getc(fn)
     game[2][2] = getc(fn)
     game[2][3] = getc(fn)
     game[2][4] = getc(fn)
     game[2][5] = getc(fn)
     game[2][6] = getc(fn)
     game[2][7] = getc(fn)
     game[2][8] = getc(fn)
     game[2][9] = getc(fn)
     game[2][10] = getc(fn)
     game[2][11] = getc(fn)
     game[3] = getc(fn)
     game[4] = getc(fn)
     game[5] = getc(fn)
     game[6] = getc(fn)
close(fn)

constant
Win = create( Window, "REVA", 0, 0, 0, 300, 200, 0 ),
game_menu  = create( Menu, "&Games", Win, 0, 0, 0, 0, 0 ),
menu_game1 = create( MenuItem, "" + game[5], game_menu, 0,0,0,0,0 )

WinMain(Win, Normal)
--------------------------- END EUPHORIA CODE
---------------------------------------

NOTE about RapidQ.
RapidQ is a Win/Dos basic like language written by William Yu, but the code
is still in the beta stage and William has stopped working on it.

---------------------------- RAPIDQ CODE BEGIN
--------------------------------------   
$Include "rapidq.inc"

TYPE gameTYPE
     x AS WORD
     race(1 TO 11) AS WORD
     trn AS STRING * 80
     rst AS STRING * 80
     name AS STRING * 20
     last AS WORD
END TYPE

DIM File AS QFILESTREAM
DIM game(8) AS gameTYPE

File.Open("gamestat.dat", fmOpenRead)
    FOR x = 1 TO 8: File.ReadUDT(game(x)): NEXT x
File.Close

CREATE Form AS QFORM
       Caption=" Q Vgaplanets Client" 
       Width=Screen.Width  
       Height=Screen.Height  
       DelBorderIcons(2)
       BorderStyle=bsSingle
       CREATE MainMenu AS QMAINMENU
              CREATE mFile AS QMENUITEM
                     Caption="&File"    
                     CREATE mLoad AS QMENUITEM
                            Caption="&New Game"
                            OnClick=clickMAINMENU
                     END CREATE
                     CREATE mDivider1 AS QMENUITEM
                            Caption="-"
                     END CREATE
                     CREATE mExit AS QMENUITEM
                            Caption="&Exit"
                            OnClick=clickMAINMENU          
                     END CREATE
                     CREATE mDivider2 AS QMENUITEM
                           Caption="-": visible=False
                     END CREATE
                     CREATE mGame1 AS QMENUITEM
                            Caption=game(1).name
                            Tag=1: OnClick=LoadGame
                            visible=False
                     END CREATE 
                     CREATE mGame2 AS QMENUITEM
                            Caption=game(2).name
                            Tag=2: OnClick=LoadGame
                            visible=False
                     END CREATE
                     CREATE mGame3 AS QMENUITEM
                            Caption=game(3).name
                            Tag=3: OnClick=LoadGame
                            visible=False
                     END CREATE
                     CREATE mGame4 AS QMENUITEM
                            Caption=game(4).name
                            Tag=4: OnClick=LoadGame
                            visible=False
                     END CREATE
                     CREATE mGame5 AS QMENUITEM
                            Caption=game(5).name
                            Tag=5: OnClick=LoadGame
                            visible=False
                     END CREATE
                     CREATE mGame6 AS QMENUITEM
                            Caption=game(6).name
                            Tag=6: OnClick=LoadGame
                            visible=False
                     END CREATE
                     CREATE mGame7 AS QMENUITEM
                            Caption=game(7).name
                            Tag=7: OnClick=LoadGame
                            visible=False
                     END CREATE
                     CREATE mGame8 AS QMENUITEM
                            Caption=game(8).name
                            Tag=8: OnClick=LoadGame
                            visible=False
                     END CREATE
              END CREATE 
       END CREATE
END CREATE

LoadGamesActivity
Form.ShowModal
---------------------------- END RAPIDQ CODE
--------------------------------------

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu