little newb questions :|

Blitz3D Forums/Blitz3D Beginners Area/little newb questions :|

Apollonius(Posted 2003) [#1]
I have a few question poping up as I work on my map editor using BlitzPlus GUI thing.
Pretty easy questions for some of you.

#1
You know in a Notify Command, how do you change lines?
Because I'm trying to make a popup window for the "about" button in the menu, never made one before so I wonder.

#2
Is it possible to make a grid on an image in GUI, or do you need to use canvas?

#3
You know in some programs, you for example click on the Menu at the top and select options, theres a popup menu, like a new window, how do you do that using blitz?

#4
Thoses label thing, how can you add more then one label on it for the user to click on?

--- ADDED
#5
How can you center a WINDOW of the client's window?

#6 ~~~~NEW~~~~
Ok so I can add as many window as I want but if I wana lock the main window while another window is popup example "Options" so like they press OK and the window closes and you can use main window again, many app use this.

--
This is it for the moment, I might ask more later, thanks for taking the time to answer with complete explications ;)


soja(Posted 2003) [#2]
1) "first line" + Chr$(10) + "next line"

2) I don't know of a way within BlitzPlus to draw on anything besides a canvas. You could probably do it, though, using GDI -- getting a device context, drawing, etc. But that would require some knowledge of Win32 stuff and API functions.

3) When you're detecting what menu was clicked on, if it was the "Options" menu, then just create a new window and give it a different name, like :

wndMain = CreateWindow("Main Window", 0, 0, 200, 200)
...
if "options" was selected in the menu, then...
wndOptions = CreateWindow("Options", 100, 100, 100, 100)
etc

You can open as many windows as you want with the CreateWindow command.

4) I'm not sure what you're talking about here. A ListBox? Make sure you take a look at the BlitzPlus User's Guide and look all the gadgets available to you (section 2.4).


cbmeeks(Posted 2003) [#3]
5)
Function ReturnCenterX(x, w)
	Local a = w/2
	Return (x / 2) - a
End Function
Function ReturnCenterY(y, h)
	Local a = h/2
	Return (y / 2) - a
End Function



x = width of the desktop
w = width of window

y = height of desktop
h = height of window

-cb


Apollonius(Posted 2003) [#4]
[<cbmeeks>]
how would I use this in example:
WinHandle=CreateWindow("something",0,20,640,480)
Your example is kind of chinese :|

[<soja>]
what does Chr$(10) mean exactly?

and label isnt label but tabber

Thanks for the help.


rdodson41(Posted 2003) [#5]
w=640 ;Window width
h=480 ;Window height
x=GadgetWidth(Desktop())/2-(w/2) ;Window x
y=GadgetHeight(Desktop())/2-(h/2) ;Window y

GadgetWidth/Height gets the width/height of the indicated gadget, in this case the desktop. Dividing it by 2 gets the position of the center of the screen. Dividing the width/height of the window by 2 gets the center of the window. Then, by subtracting the window center from the screen center, the center positions line up, therfore making 'x' and 'y' so that the window is centered.



Chr$() is a function built into B+. It takes the Ascii code of the number in the parenthesis (in this case 10) and returns are string corresponding to that number. For 10 it returns a Line Feed, or makes a new line.


Have you bought B+? because it comes with a Command Reference in the help section. You can also find a Command Reference somewhere on this site, where i dont remeber.

Hope it helps!
-Rich05


Apollonius(Posted 2003) [#6]
Yes, I bought Blitz else I wouldnt be here, you need a key from when you buy it to enter the forums, yes I have the ref thing but it isnt always very clear and yes thanks it helped.

this below worked very well!
w=640 ;Window width
h=480 ;Window height
x=GadgetWidth(Desktop())/2-(w/2) ;Window x
y=GadgetHeight(Desktop())/2-(h/2) ;Window y

WinHandle=CreateWindow("something",x,y,w,h)

I however tryed this bellow
CreateTabber( 0,0,w,h,WinHandle )
i want it to auto ajust when i maximize how do i do it?

---
oh and I noticed when using Notify the little window has blitzcc as title how do i change that?


soja(Posted 2003) [#7]
i want it to auto ajust when i maximize how do i do it?


Look up SetGadgetLayout

oh and I noticed when using Notify the little window has blitzcc as title how do i change that?


Look up AppTitle


Apollonius(Posted 2003) [#8]
Main this is great thanks guys, check back later I might add questions as I'm advancing toward canvas part ad im not good at that :)

Im at my 141 Line of code and working thanks to you guys :)
Blitz IDE should really have an undo button :|


Apollonius(Posted 2003) [#9]
Ok, what code should I use to detect which one of the Tabber the user is on right now?

SetGadgetLayout mainTabber,1,1,1,1
InsertGadgetItem(mainTabber,0,"1")
InsertGadgetItem(mainTabber,1,"2")
InsertGadgetItem(mainTabber,2,"3")

:|?


WolRon(Posted 2003) [#10]
Which is why most people use a seperate IDE.

May I recommend Visual Blitz IDE?


Apollonius(Posted 2003) [#11]
([WolRon])
If you have a full version to send me by email, yes sure send.
Which I pretty much doubt, but I didnt ask for
a program, I'm actually always updated on peoples creations, I like seeing what other people make :)

I'm still just a kid, don't urn my own money yet and
visual blitz isnt free, and I was totally in luck that
my mom paid me Blitz. She doesnt ever buy stuff online.

Anyhow, thanks anyway.


soja(Posted 2003) [#12]
Ok, what code should I use to detect which one of the Tabber the user is on right now?


You should just keep track of it. Or you can just iterate through all your tabs and compare them to what EventData returns after a GadgetAction event where the gadget that "acted" was your tabber. Here's what I do:

In your main event loop, check for the GadgetAction event. If that event occurs, check to see if it was your tabber. If so, then switch the tab according to the tab that the user clicked on (returned from EventData()), like this:

Select WaitEvent()
	Case evGadgetAction
		Select EventSource()
			Case mainTabber : ChangeTab(mainTabber, EventData())
...etc

Then for the ChangeTab function, you can do something like this:
Function ChangeTab(gadget, tab)
	Select gadget
		Case tabber
			SelectGadgetItem(tabber, tab)
			For i = 0 To CountGadgetItems(tabber) - 1
				If (i = tab) Then
					ShowGadget(tabpanel(i))
				Else
					HideGadget(tabpanel(i))
				EndIf
			Next
	End Select
End Function


Technically, you don't need all that because you'll notice that it switches tabs automatically. The problem comes when the items IN the tab don't change. What I did here is create a Panel that filled up the entire tab area, one Panel for each Tab. (I used an array so that I could index them, so tabpanel(0) would be the first tab, etc.)

Then when a new tab is selected, all I had to do was hide the Panel gadget for the old tab, unhide the Panel gadget for the new tab, and it hides/shows everything under the tab perfectly. Just make sure you draw all your gadgets, etc, on the appropriate panel.

Does that help?


Apollonius(Posted 2003) [#13]
No I completly dont understand sorry :(


soja(Posted 2003) [#14]
Ok, that was a whole bunch of info about a problem you don't even have (or know you have) yet. To go back to the original question "what code should I use to detect which one of the Tabber the user is on right now?", use the SelectedGadgetItem command.


Perturbatio(Posted 2003) [#15]

Blitz IDE should really have an undo button :|


It has one level of undo (Use CTRL+Z), not brilliant, but good enough if you spot the mistake straight away.