just wondering........

BlitzPlus Forums/BlitzPlus Beginners Area/just wondering........

Paul A. B.(Posted 2005) [#1]
I have two questions.

One - Is there any way B+ can open and edit files(like .txt), or extract info from the file and use it as a variable?

Two - I am slightly familiar with Visual Basic, and I was wondering if there were any tools(commercial or freeware, i dont care) that use the b+ compiler that I already have, but have a nice IDE and drag and drop form creators like VB?

Thanks


Paul A. B.(Posted 2005) [#2]
Also, I want to know if i made a button gadget, how owuld I show that if teh button is clicked, then do something, or open another form??


CS_TBL(Posted 2005) [#3]
code it manually ..

If EventSource()=MyButton ; the button?
If EventID()=$401 ; and you clicked on it?
win2=CreateWindow("2",32,32,640,480,parent)
EndIf
EndIf


WolRon(Posted 2005) [#4]
1) Yes, look at ReadFile, WriteFile and OpenFile.

2) Not exactly an IDE, but I've definitely seen some Blitz code that works a little like a Visual editor. I just can't remember where I've seen it.

Also, I want to know if i made a button gadget, how owuld I show that if teh button is clicked, then do something, or open another form??

;main loop to handle events 
Repeat
	event = WaitEvent()
	If event = $401 ;gadget action
		source = EventSource()	
		Select source
			;main buttons
			Case CommButton
				;open comm window
				DisableGadget Mainwindow
				CommWindow = CreateWindow("Communications Setup", 100, 100, 200, 200, Mainwindow, 1)
				CreateButton("OK", 80, 140, 40, 20, CommWindow)
		End Select
	EndIf ;gadget action
	If event = $803 ;Close (X) box pressed
		source = EventSource()
		If source = Mainwindow Then Exit
		If source = CommWindow
			EnableGadget Mainwindow
			FreeGadget CommWindow
			CommWindow = 0			
		EndIf
	EndIf
Forever



MattVonFat(Posted 2005) [#5]
Wasn't there a tutorial about creating your own gadgets? I remember seeing one before the forums changed about.


CS_TBL(Posted 2005) [#6]
yeah, that was *my* tutorial .. :) perhaps a search for CreateSomething still works?


CS_TBL(Posted 2005) [#7]
DREAD! Did they actually wipe the whole tutorial section as it was before Bmax came out and the forum got fubar'ed ?


Paul A. B.(Posted 2005) [#8]
THaks, I also just found out that if you go to the toolbox and form editors, you can get some programs to ake forms with gadgets. Thanks for your help


CS_TBL(Posted 2005) [#9]
Do try 'coding' them, rather than dragging/dropping them .. it's a matter of habit/style I guess, but programming a layout really isn't a lot of work, and it increases code-skills anyway :)


Paul A. B.(Posted 2005) [#10]
THanks alot, and i have a final question. Say you have a windows called window_1, and on that windows you created two buttons, and you wanted to make clicking the first print hello and the other button exit the program(this is just an example). How can you make that happen? THanks so much.


CS_TBL(Posted 2005) [#11]
window1=CreateWindow("window 1",32,32,640,480)

Global button1=CreateButton("hello",32,32,64,24,window1)
Global button2=CreateButton("quit",32,64,64,24,window1)

Global quit

Repeat ; main loop

	WaitEvent()
	If EventID()=$803 quit=True ; window close button / alt-f4
	
	evApp()
	
Until quit
; do clean-up stuff here, if required.
End



Function evApp()
	If EventID()=$401 ; buttonpress?
		If EventSource()=button1
			Notify "Hello"
		EndIf
		If EventSource()=button2
			quit=True
		EndIf
	EndIf
End Function


'Printing Hello' is a bit undefined here .. *where* to print it? Using notify? Changing the caption of a label? graphically writing into a canvas? the caption of the actual app-window?


Beaker(Posted 2005) [#12]
If you want form creation I recommend getting hold of GUIde:
www.playerfactory.co.uk