|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Sujet n° 1611 |
Monumental accomplishment! |
le 14/04/2008 @ 23:42 par Nate Weil
|
I know I haven't posted in a while, I only started using izibasic again recently... I haven't been programming for a while. After working long hours on my latest creation, "Astro Miner" and figuring out all about custom forms which I now can't wait to dive into, I decided to try and get a window going, one like any window on a computer. One you could resize, move around, close, and have objects in. Unfortunately you haven't made izibasic an OO language so this was a lot tougher than it could have been, but I have successfully made a window anyways! It has three buttons which change its' color, a button to make it smaller and a button to make it bigger, a button to close it, and a button off of the window to create it again. I did this using the A-Z variables and a few custom variables. I did not organize anything into "objects" yet but that will come soon. I apologize for the sloppy code, that will be fixed in version 2. Here is the code, have fun :)
' window.ibas
' Listing generated by ViziBasic v2.1 ' 05/02/2005 @ 14:33:11
{CREATORID "wndw"} {VERSION "1.0"} '{MINOSVERSION "3.0"} '{PARSER OFF} '{KEYEVENTS OFF} '{SECUREFILES ON} '{CONSOLEFONT ON}
DIM %EVT%,%P1%,%P2%,%P3%,%X% DIM %P1$,%P2$,%P3$,%A%,%Y% DIM %E%
BEGIN GOSUB _OnAppStart GOSUB _GenerateGUI GOSUB _EventsLoop GOSUB _OnAppExit END
_GenerateGUI: %E%=%X%/14 A=I+%E% %E%=%Y%/2.8 B=J+%E% %E%=%X%/2 C=I+%E% %E%=%Y%/1.7 D=J+%E% %E%=%X%/14 E=I+%E% %E%=%X%/1.3 F=J+%E% G=I %E%=%X%/3.5 H=J+%E% K=I+%X% L= H+%Y% M=I+%X% %E%=%Y%/3.5 N=J+%E% %E%=%Y%/35 O=I+%E% %E%=%Y%/17.5 P=J+%E% %E%=%Y%/1.2 U=I+%E% %E%=%Y%/14 V=J+%E% LABEL #7,"Window 1",O,P
%P1$="1" SETFONT 0 BUTTON #3,%P1$,A,B,20,12 %P1$="2" SETFONT 0 BUTTON #4,%P1$,C,D,20,12 %P1$="3" SETFONT 0 BUTTON #5,%P1$,E,F,20,12 %P1$="x" SETFONT 0 BUTTON #6,%P1$,U,V,10,10 %E%=%Y%/35 U=I+%E% %E%=%Y%/0.9 V=J+%E% %P1$="-" SETFONT 0 BUTTON #8,%P1$,U,V,10,10 %E%=%Y%/4.3 U=I+%E% %E%=%Y%/0.9 V=J+%E% %P1$="+" SETFONT 0 BUTTON #9,%P1$,U,V,10,10 %P1$="New Window" SETFONT 0 BUTTON #10,%P1$,70,1,90,11
COLOR R BOX I,J TO M,N COLOR R BOX G,H TO K,L RETURN
_EventsLoop: REPEAT %EVT%=DOEVENTS SELECT CASE %EVT% CASE 3 GOSUB _BUTTON_3 CASE 4 GOSUB _BUTTON_4 CASE 5 GOSUB _BUTTON_5 CASE 6 GOSUB _BUTTON_6 CASE 8 GOSUB _BUTTON_8 CASE 9 GOSUB _BUTTON_9 CASE 10 GOSUB _BUTTON_10 CASE 1000 GOSUB _BUTTON_1000 END SELECT UNTIL %EVT%=-1 RETURN
_BUTTON_3: R=0 GOSUB _GenerateGUI RETURN
_BUTTON_4: R=16711680 GOSUB _GenerateGUI RETURN
_BUTTON_5: R=255 GOSUB _GenerateGUI RETURN
_BUTTON_6: FOR Z=1 TO 7 DESTROY #Z NEXT CLS %A%=1 RETURN
_BUTTON_8: %X%=%X%-5 %Y%=%Y%-5 CLS GOSUB _GenerateGUI RETURN
_BUTTON_9: %X%=%X%+5 %Y%=%Y%+5 CLS GOSUB _GenerateGUI RETURN
_BUTTON_10: %A%=0 GOSUB _GenerateGUI RETURN
_BUTTON_1000: IF %A%=0 THEN X=PENX Y=PENY IF X>I THEN IF X<M THEN IF Y>J THEN IF Y<N THEN I=X-35 J=Y-10 COLOR 16777215 BOXFILLED 0,0 TO 160,160 OPENFORM 0 GOSUB _GenerateGUI ENDIF ENDIF ENDIF ENDIF ENDIF RETURN
_OnAppStart: I=50 J=50 %X%=70 %Y%=70 RETURN
_OnAppExit:
RETURN
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1 -------- le 15/04/2008 @ 19:05 par nate Weil
visiteur |
I forgot to add a litttle bit of instructions, so here's how to use the app should you decide to try it out: the X button closes the window. Press new window to open it again. The - makes the window smaller, and all the buttons scrunch together a bit. The + button makes it bigger and the buttons spread out. To move the window, tap and hold on the "menu bar", the smaller square in the window on top. Then, making sure you stay within the boundaries, drag it around! If you drag too fast, the window location can't keep up and you will lose control of the window. So drag kinda slow, or make the window bigger for more room to move. 1 changes the window to black, 2 makes it blue, and 3 makes it red. Feel free to email me with questions if you have any and I'll try to answer them. Also I would love it if someone has improvements on the code, I already am working on a two window app, that will still use just the alphabet variables, I will accomplish this by reusing variables a ton. |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 2 -------- le 26/04/2008 @ 23:52 par aldweb
visiteur |
Hello Nate,
"Unfortunately you haven't made izibasic an OO language" No, I haven't... I made an other philosophical choice for iziBasic
Your idea and implementation are very smart, I never thought about moving and resizing a window this way, even though I know that I should implement some similar stuff for moving controls by drag & drop within ViziBasic.
Maybe should you use the A() array for a multiple-windows extension, or some database file (database access in a Palm is almost as fast as a memory access).
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 3 -------- le 27/04/2008 @ 18:12 par Nate Weil
visiteur |
unfortunately I haven't been able to get around to working on this... I've been busy and I've been having palm trouble. But next time around I plan on using arrays so I can do the multiple windows :) Why can't you just add types? If you added that simple functionality, I could do this soooo much easier... |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 4 -------- le 30/04/2008 @ 18:26 par aldweb
visiteur |
If you added that simple functionality, I could do this soooo much easier...
Sure, but that functionality is not easy to code for me... It would require to reingineer all of iziBasic's compiler and runtime, meaning rewriting maybe 90% of iziBasic's source code.
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 5 -------- le 30/04/2008 @ 18:52 par nate Weil
visiteur |
hehe maybe I should have thought about it before posting lol I guess it is a pretty hard thing to do. *sigh* Thanks anyways :) |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 6 -------- le 02/06/2008 @ 05:06 par enotar
visiteur |
I was passing trough few hours ago after a long time away & I just see that ! This is unbelievable!;Nate you did such a great job. I cannot wait to see the 2 windows or even 3. I am still analyzing the code but this is working very smooth on my Treo 680. If you can achieve multiple windows ,this could be a sensational breakthrough for Izibasic
Just Great!
enotar |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 7 -------- le 28/06/2008 @ 00:08 par Nate Weil
visiteur |
Sorry but someone else will have to carry on with it. I don't have a palm any more :( |
|
|
sujet actif
sujet clos
Important!
Nouveau message -
Rectifier message
Clôturer sujet
Remonter
|
|