Update on Program Installer

BlitzMax Forums/BlitzMax Beginners Area/Update on Program Installer

An earlier post of mine had some great tips and some great advice. I am happy to inform you that I have a working code with UI. This is what I was in need of.

Here is the code if you want to use it:

'Source Code created on 24 Sep 2007 19:32:18 with Logic Gui Version 2.2 Build 262
'John Doe
'> > > HEADER FILE NOT FOUND !!!

Import PUB.FreeProcess
 
Local Logic_Gui:TGadget = CreateWindow:TGadget("Installer Selector",240,73,655,466,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE |WINDOW_MENU |WINDOW_STATUS |WINDOW_CLIENTCOORDS )
Local Button1:TGadget = CreateButton:TGadget("Install Program",61,93,160,33,Logic_Gui:TGadget,BUTTON_PUSH)
Local Button2:TGadget = CreateButton:TGadget("Install Program",61,156,161,35,Logic_Gui:TGadget,BUTTON_PUSH)
Local Button3:TGadget = CreateButton:TGadget("Install Program",61,220,160,31,Logic_Gui:TGadget,BUTTON_PUSH)
Local Button4:TGadget = CreateButton:TGadget("Install Program",62,282,159,28,Logic_Gui:TGadget,BUTTON_PUSH)
Local Button5:TGadget = CreateButton:TGadget("Exit",62,333,159,33,Logic_Gui:TGadget,BUTTON_PUSH)

Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			Select EventSource()
				Case Logic_Gui	Logic_Gui_WC( Logic_Gui:TGadget )
			End Select

		Case EVENT_GADGETACTION
			Select EventSource()
				Case Button1	Button1_GA( Button1:TGadget )
				Case Button2	Button2_GA( Button2:TGadget )
				Case Button3	Button3_GA( Button3:TGadget )
				Case Button4	Button4_GA( Button4:TGadget )
				Case Button5	Button5_GA( Button5:TGadget )
			End Select

	End Select
Forever

'> > > APPEND FILE NOT FOUND !!!

Function Logic_Gui_WC( Window:TGadget )
	DebugLog "Window Logic_Gui wants to be closed"
'	HideGadget( Window:TGadget )

	End
End Function

' 	You will see from reading and playing around with this code 
'	that each button created launches the Notepad. You can simply 
'	change Notepad To whatever program you wish To install. Make 
'	sure the path is correct.

Function Button1_GA( Button:TGadget )
	
	Local proc:TProcess
	proc=TProcess.Create("Notepad",0)
	While proc.Status()
	Wend
	
End Function

Function Button2_GA( Button:TGadget )
	
	Local proc:TProcess
	proc=TProcess.Create("Notepad",0)
	While proc.Status()
	Wend
	
End Function

Function Button3_GA( Button:TGadget )
	
	Local proc:TProcess
	proc=TProcess.Create("Notepad",0)
	While proc.Status()
	Wend

End Function

Function Button4_GA( Button:TGadget )
	
	Local proc:TProcess
	proc=TProcess.Create("Notepad",0)
	While proc.Status()
	Wend

End Function

Function Button5_GA( Button:TGadget )
	
	DebugLog "Button Button5 was pressed"

End Function



I have 3 followup questions. When you launch this program, you will see that each button labeled "Install Program" launches NOTEPAD. Simply changing NOTEPAD to the path of your file will be great and it works. Here is where I have my first followup question.

The installer that I am in need of creating will use this code, but will all be on CD/DVD. Since the drive letters of the CD/DVD may differ from one person to another, is there a way to code it to where it keeps the CD/DVD Drive letter or takes the CD Drive letter from the PC itself? "C:\" is the hard drive. Some people have more than one hard drive and it is letter "D:\." This leaves the CD/DVD drives to be another letter.

My second follow up question is using one of the buttons to close the window. I have searched and could not find the code. Can someone show me a good close window command please?

My third followup question is about an ICON file. I found a tutorial 'Adding Icons to BlitzMax Win32 Executables." This is not really a question. This is rather a work in progress.

I will keep you informed. Thanks again for all the advice.

1.) Why do you need the letter of the cd drive? If you're running your app from CD you can use relative paths.

2.) FreeGadget (Logic_Gui)

3.) You've already found the solution. Any particular question?

1.) As Jake said...
2.) Depends if you need that window later on again? If yes, just hide it with HideGadget( Logic_Gui ) and show it again with ShowGadget( Logic_Gui ). If no, you can free it as Jake mentioned to get rid of it, but that needs complete recreation if you want it back.
Off topic: You probably want a different name for your program, to do so just open the Properties Editor and click on the left side on 'Main Window' and edit the text now visible in the tabber.

Thanks again for the replies.

I added this to the code to button 5.


Function Button5_GA( Button:TGadget )
	
FreeGadget Logic_Gui_WC( Logic_Gui:TGadget )	

End Function



This fixes the closing problem. Thanks.

The Logic_Gui gadget is out of scope for that function.
You can either make it global or obtain it from the button.parent field (I think).

(...tonyg was faster ;)

May I suggest to forget about LogicGUI for a minute and play with some MaxGUI examples to get "the feel" for Blitzmax/MaxGUI's way of doing things. Don't get me wrong, LogicGUI is a great app (I use it, too), but it's a helper-app to shorten forms development, not an IDE replacement.