English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 22 February 2010, 20:28   #1
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
AmiBlitz code

Hello,
I´m trying to code an application in Amiblitz and need to learn about NewType´s the unique example I found it´s the one at bottom and it doesn´t compile because an error appears and as I´m a newbie in AmiBlitz I can´t fix it.. yet

Can someone here try to fix it so I can compile it please?

Thanks in advance

WbToScreen 0
ShowScreen 0

NEWTYPE .lview
pos.w
nom$
End NEWTYPE

Dim List MaListe.lview(100)

succes=AddItem(MaListe())
If succes=-1 Then MaListe(i)s=1,"Youpi !"

Window 0,0,0,330,135,$143F,"GadTools Test",1,2

GTCycle 0,1,0,-5,150,13,"",0,"Choix1 | Choix2 | Choix3"
GTListView 0,2,0,20,150,75,"",$800,MaListe()
GTString 0,3,160,-5,125,13,"",0,150
GTInteger 0,4,160,30,125,13,"",$4,0
AttachGTList 0,0

Repeat
ev.l=WaitEvent
If ev=$40
If GadgetHit=1
choix=EventCode
GTSetInteger 0,4,choix
EndIf
If GadgetHit=2
x=EventCode
GTSetString 0,3,MaListe(x)om
EndIf
EndIf
Until ev=$200

Free Window 0
Free GTList 0
Forbid_
End

Thanks in advance
AlfaRomeo is offline  
Old 23 February 2010, 13:59   #2
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Hi it has been a very very long time since I did any blitz but the following code is from an early version of my old Swoseditor..

Code:
Dim List mark.mpg(47)

<snip>

Dim vals.w(30)               ; Value of player
Dim vals2$(30)
Dim vals$(48)               ; Actual Values

<snip>

Restore Values
For i=1 To 48
  Read a$
  vals$(i)=a$
Next i
A=1
While AddItem(mark()):mark()\m=vals$(A):A+1:Wend


<snip lots of code>

Values:
Data$ "25k","30k","40k","50k","65k","75k","85k","100k","110k","130k","150k","160k","180k","200k","250k"
Data$ "300k","350k","450k","500k","550k","600k","650k","700k","750k","800k","850k"
Data$ "950k","1M","1.1M","1.3M","1.5M","1.6M","1.8M","1.9M","2M","2.25M","2.75M","3M","3.5M","4.5M","5M","6M"
Data$ "7M","8M","9M","10M","12M","15M"
and then my gtlistview is

Code:
GTListView 11,0,34,13,100,60,"Select New Value",0,mark()
Naturally I have removed code that is not relevant..
BippyM is offline  
Old 23 February 2010, 15:26   #3
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
@ bippym

thanks for your example, I´m trying to understand NewTypes and the examples help a lot.

Thanks to Der_Wanderer at Amiforce.de the code I posted before now works and was improved to AmiBlitz 3:

optimize 7
Syntax 2

WbToScreen 0
ShowScreen 0

NEWTYPE .lview
pos.w
nom.s
End NEWTYPE

Dim List MaListe.lview(0) ; set 0 if you want dynamic lists

If (AddItem(MaListe())) Then MaListe()\pos = 1,"Youpi !"

Window 0,0,0,330,135,#WFLG_CLOSEGADGET|#WFLG_ACTIVATE|#WFLG_DEPTHGADGET|#WFLG_DRAG BAR,"GadTools Test",1,2

GTCycle 0,#@myCycleGad , 0, -5,150, 13,"",$0,"Choix1|Choix2|Choix3"
GTListView 0,#@myListView , 0, 20,150, 75,"",$800,MaListe()
GTString 0,#@myStringGad ,160, -5,125, 13,"",$0,150
GTInteger 0,#@myIntegerGad,160, 30,125, 13,"",$4,0

AttachGTList 0,0

Repeat

ev.l=WaitEvent
Select ev
Case #IDCMP_GADGETUP

Select GadgetHit
Case #myCycleGad
option.l=EventCode
GTSetInteger 0,#myIntegerGad,option

Case #myListView
listindex.l = EventCode
ResetList MaListe()
While listindex>0:NextItem MaListe():listindex-1:Wend
If NextItem(MaListe())
GTSetString 0,#myStringGad,MaListe()\nom
End If

End Select
End Select

Until ev=#IDCMP_CLOSEWINDOW

End


Now the compiler gives me a error "Constant not found" at the line with the window flags "#WFLG_..." theoretically the compiler should recognize the flags instantly but it thinks that the window flags are constants didn´t know why
AlfaRomeo is offline  
Old 23 February 2010, 16:46   #4
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
I don't use the blitz commands.. If you want any of my Swos source I don't mind.. It's not been compiled in years but it should compile ok.. and you'll need certain libs.. I have numerous updates etc
BippyM is offline  
Old 23 February 2010, 18:39   #5
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
@ bippym

If you could upload that source code to the zone I will be grateful because only with examples I can learn and there aren´t much AmiBlitz examples on the net, specially Amiblitz3 examples.

Quote:
Originally Posted by AlfaRomeo View Post
...theoretically the compiler should recognize the flags instantly but it thinks that the window flags are constants..
Ok, already understood why it happens,
Der_Wanderer had aready said that it´s better add "all.res" to compiler settings but I didn´t realize what is "all.res" or what is it for
"all.res" it´s a BlitzLib/Resident file and is like includes at C.
When added to Compiler settings all compiles ok
AlfaRomeo is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
AmiBlitz 3 AF2013 Coders. Blitz Basic 13 26 September 2013 00:27
Amiblitz Forum AlfaRomeo Amiga scene 0 31 July 2013 01:43
AmiBlitz 3 slk486 support.Apps 2 16 May 2010 21:26
Amiblitz ML in english ??? mrodfr News 1 13 January 2006 19:30
New Amiblitz (2.42) released Paul News 0 06 September 2004 20:01

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 16:17.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07242 seconds with 13 queries