Unstable?
Blitz3D Forums/Blitz3D Beginners Area/Unstable?
| ||
I just switched from Blitz 2 to Blitz+. So, in order to learn the GUI commands and programming, I do what I normally do with new software. I experiment with the commands and their interactions. But I am having a problem with my tests not responding. too often, my programs are crashing or taking a ,long time to close. Even some thing as simple as the following crashes: Global sw=ClientWidth(Desktop())*90/100 sw2=sw Global sh=ClientHeight(Desktop())*90/100 sh2=sh Global mainw=CreateWindow("Music Vox",0,0,sw,sh,0,15) Global cc=CreateCanvas(0,0,sw,sh,mainw) SetBuffer CanvasBuffer(cc) CreateSlider( sw-25,0,20,sh-80,mainw,2) Color 225,0,0 :Rect 0, 0, sw2-25, sh2-80, 1 While Not KeyHit(1) Txt$="1234567890" For i=2 To 11 T$=Mid(Txt$,i-1,1) CreateButton(T$,i*30,30,30,30,cc,1) Color 0,0,0 :Text 100,100,"WWWWWWWWWWWWWWWWWW" x$=Input(aaaaaaaaaaaaaaaaa) Print x$ Next Wend End It crashed even without the While Whend instruction. Basically, I would like to understand the way in which non-GUI commands can interact with GUI instructions. Why is my simple program crashing? Thanks for any help with this. |
| ||
there is a lot going on there, and you must remember that BlitzPlus is doing some things different than Blitz2D. Especially the input and print functions will open up a console window, why I don't know, but it is so. Maybe someone more knowledgeable can tell us. anyway, you have way too much inside your loop, try this...mainw=CreateWindow("Music Vox",0,0,600,400,0,15) cc=CreateCanvas(0,0,600,400,mainw) SetBuffer CanvasBuffer(cc) CreateSlider( 567,0,25,200,cc,2) Color 225,0,0 Rect 0,0,600,400,1 For i%=1 To 10 CreateButton(Str(i%),i*30,30,30,30,cc,1) Next ExitNow=CreateButton("exit",30,70,80,30,cc,1) Color 0,0,0 Text 100,100,"Click the button to quit" Repeat If WaitEvent()=$401 Then If EventSource()=ExitNow Then Exit End If Forever End I just changed your code a little and more simple, hope this helps... |
| ||
Actually, the code I posted is a little bit sloppy because I am simply experimenting with the use of commands in B+. I had tested the text command already with no problem. It is when I add the input command that I get the problems. I want to have an imput somewhere in the page. In Blitz Basic I would have used the locate command. What do I do in B+? Of course, after I learn this, then I'll have to ask about the next thing that works differently in the two programs -- whatever it is. PS: Your code was useful. it's very clean, thanks! |
| ||
There are so many things about BlitzPlus that I do not understand, so I am *not* qualified to give advice apart from very simple things. My best advice is to look in the examples folder, and in the code archives, find where someone is doing the thing you want, and figure out backwards how it works. I'm sure you will find some stuff about input in the arcs. cheers |
| ||
keyboard is right. You definately want to start getting used to writing your code more event driven, when you're dealing with BlitzPlus. Not only does it provide easier to read code (IMHO) it also means that your program will interface with the natural flow of the operating system, and won't have to be pre-empted all the time. |
| ||
That would be great if it was easy to do. I learned Blitz by working on programs and looking at the help files. The command refference was great and quite descriptive. It had short, yet specific examples of how to use every command. Blitz+ is missing this in most GUI commands. The samples are complex and full of instructions that I must weed out. This takes a very long time. I hope Blitz+ gets a full set of command refference examples soon. |
| ||
Check out "GUI CATEGORY" in BlitzPlus Help. there will be functions in "TEXT FIELDS" and "TEXT AREAS" that might provide the input facility that you need... "TextFieldText" and "TextAreaText" return the text entered by a user in the TextField or TextArea respectively... |
| ||
I also found that if you lookup any of the GUI functions with the online help docs that can be pretty usefull. |
| ||
This is what I am talking about. For instance, as Keyboard suggested, I looked into Text fields. This is what I found: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; TextAreaText$( textarea ) Parameters textarea - A textarea gadget handle Description Returns the text contained in a textarea gadget. Index Click here to view the latest version of this page online with user comments ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; On the other hand, go to the 2D chategory, search for any thing and you will get very valuable information. For instance, check OpenFile and you get: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; OpenFile (filename$) Definition Opens a file on disk for both reading and writing operations i.e. for update. Parameters filename$ = any valid path and filename. The returned value is the filehandle which is used by other file handling commands. Description This command opens the designated file and prepares it to be updated. The file must exists since this function will not create a new file. By using FilePos and SeekFile the position within the file that is being read or written can be determined and also changed. This allows a file to be read and updated without having to make a new copy of the file or working through the whole file sequentially. This could be useful if you have created a database file and you want to find and update just a few records within it. The file handle that is returned is an integer value that the operating system uses to identify which file is to be read and written to and must be passed to the functions such as ReadInt() and WriteInt(). Note extreme care needs to be exercised when updating files that contain strings since these are not fixed in length. Example ; Changing part of a file using OpenFile, SeekFile and WriteInt ; Open/create a file to Write fileout = WriteFile("mydata.dat") ; Write the information to the file WriteInt( fileout, 1 ) WriteInt( fileout, 2 ) WriteInt( fileout, 3 ) WriteInt( fileout, 4 ) WriteInt( fileout, 5 ) ; Close the file CloseFile( fileout ) DisplayFile( "The file as originally written", mydata.dat" ) ; Open the file and change the Third Integer file = OpenFile("mydata.dat") SeekFile( file, 8 ) ; Move to the third integer in the file WriteInt( file, 9999 ) ; Replace the original value with 9999 CloseFile( file ) DisplayFile( "The file after being midified", "mydata.dat" ) WaitKey() ; **** Function Definitions follow **** ; Read the file and print it Function DisplayFile( Tittle$, Filename$ ) Print tittle$ filein = ReadFile( Filename$ ) While Not Eof( filein ) Number = ReadInt( filein ) Print Number Wend CloseFile( filein ) End Function Index Click here to view the latest version of this page online with user comments ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Do you see the difference? |
| ||
it is true, you make your point! and if you look at "related commands" to try and clarify the usage, it is the same example, not a differnt example to help your confused mind! that is such a pain! if only "related commands" had a different example :) BUT there is plenty of code in the "EXAMPLES" folder, and doing a "text search" through these examples for the function you are trying to come to grips with can help more the "help" does... I think it is cos programmers are more interested in programming than documentation... |
| ||
You are right. But Blitz 2 had the best refference / tutorials / examples I have ever seen for any computer program. It was a disappointment to find such difference between Blitz 2 and Blitz +. I hope they work on this soon, before I have already learned the hard way :) |
| ||
Have to agree with you Guillermo, The reason I bought Blitz+ over B2D or B3D is because of the GUI commands. The big disappointed has been the lack of in-depth, thorough, documentation found in B2D & B3D. As a result I have seldom used the GUI because it's easier to work it all out using B2D coding style (plenty of examples and posted code). Things are looking up though, download Blitz+ v1.37 update and v1.37 docs update. These docs are so much better than the docs from v1.11, the latest version when I first bought B+. Seems that using the GUI will be a lot easier now! Cheers, Andy |
| ||
I found and downloaded the Blitz+ v1.37 update. But I could not find the docs v1.37 update. Where is it? my documentation is still the same. |
| ||
If I remember correctly, the docs were a separate link beneath the link to v1.37 update. If not just email support@... for the link to the docs. |
| ||
Thanks Andy! I emailed support. There was no link for Blitz + docs. |
| ||
I just checked the online manuals and there was plentu of useful documentation for the GUI. Is thes something new or something I had missed? Any way, thinks are looking much better now that I found these manuals. Thanks every body! |