HighGUI 3

BlitzMax Forums/BlitzMax Programming/HighGUI 3

Diablo(Posted 2006) [#1]
Links here are now incorrect!
Site is now :: http://www.highgui3.com/

Update Log (as of Update 5)
Update 5

+ Added: lock and unlock to windows
+ Fixed: clipping problems with list/comboboxes
+ Added/Changed: Listboxes now scroll smoothly
+ Added: hi_TCreateBasic:hi_TGadget(x%, y%, w%, h%, parent:hi_TGadget) <- use this for pannels and grouping stuff together
+ Added: a character limit to textboxes (still havent tested this to the max)
+ Added: a line length limit to textboxes.
+ Fixed: A minior problem with hide (I hope X )



Pretty much out of beta now !?

Please check out the Website as well and tell me what you think.

HighGUI Info
HighGUI 3 is a free GUI brought to you by DiabloGames.

The GUI was deigned to easily setup a GUI environment for
your game's. Whether you just want to develop prototypes,
or full blown game's with a robust GUI, HighGUI is the GUI
for you.

Extendibility
Because of the design of the GUI module it is extremely
easy to extend. You can create your own themes to
completely change how it looks and feels, also you can extend the functionality by creating your own gadgets.

Functionality
Currently the GUI features the following gadgets:

+Windows
+Buttons
+Pictureboxes
+Canvases
+Tabgroups
+Listboxes
+Comboboxes
+Scrollbars
+Labels
+Tickboxes
+Radioboxes
+Textboxes
+Progressbars
+Groupbox
+Spinners

Screenie


Example code

Direct Download Links
Download Full
Download Lite (no examples)

Please note, this release is to get the basic engine out the door, Please post feature request below, or better still email them to me (email in profile)

You have my word now! this will be the final time I rewrite the entier engine :)


Sean Doherty(Posted 2006) [#2]
I didn't realize that there was another GUI for BlitzMax. I'm pretty nervous about using anymore GUI's.

Do you support different fonts and font sizes for controls such as text boxes and labels?

Is the development of this library activley under development or do you consider it complete?

Any completed games using it?

Thanks


tonyg(Posted 2006) [#3]
@Sean, Why nervous? It's free!

Please note, this release is to get the basic engine out the door,


should answer your 'under development?' question.


Diablo(Posted 2006) [#4]
Do you support different fonts and font sizes for controls such as text boxes and labels?

Yes.
hi_TGadget.SetFont(URL:Object, Size% = 12, fStyle% = SMOOTHFONT) 


Look here for most of the features

Is the development of this library activley under development or do you consider it complete?

It is very much still in development.

Any completed games using it?

No not yet, but this version has only just come out and its a complete engine rewrite so its hopefully much more robust.

Sry for the late reply but i'm having trouble posting, ARGH!

EDIT:
Why nervous? It's free!

I keep forgetting to mention that :D


Sean Doherty(Posted 2006) [#5]
Time? My time is not free and I feel like I've wasted a lot of time on libraries that don't do what I thought they might and are no longer being developed.


tonyg(Posted 2006) [#6]
Good point.
I set aside time for tinkering with stuff and call it 'research'. If I need something it's worth trying out what's available.
MaxGUI is good for applications, IGLass is good but just a bit 'clunky' for games.


Sean Doherty(Posted 2006) [#7]
When I started my game I went with IGlass because it seemed good. However, as time went on I found issues and missing features. Since I work full time, I knew it was going to take a long time for me to finish my game. As such, I figured that IGlass would been really feature rich and issue free.

However, there has hardly been any new features since I bought the product. Now, I find is necessary to rip out all the IGlass code and start new. I guess I'm a bit disappointed in myself for not only buying it, but using it.

Others, may disagree and think I'm being to hard on Fliax. That said, I paid $37.00 Canadian in October 2005 and since that time there has been nearly no updates other than to keep pace with new releases of BlitzMax.

Thanks


tonyg(Posted 2006) [#8]
Have you told him which features you need? You never know!


Diablo(Posted 2006) [#9]
Update
------------------------------
Update 3 [14/06/2006]: 
Added: hi_TTextbox.SetMask(mask$) 
Added: hi_TTextbox.GetMask$() 
Added: hi_TTextbox.SetMask(mask$) 
Added: SetCaretImage(image:TImage) 
Added: GetCaretImage:TImage() 
Added: ToggleDrawBackframe(toggle%) 
Added: GetDrawBackframe%() 
Fixed: A Problem with list boxes. (i.e. they now change the selected item on a mouse hit instead of on a mouse press.) 


Get it here

Thx to ppl who have emailed me to improve it thus far.


Zumwalt(Posted 2006) [#10]
Looking great so far, TextBox needs an scrollbar when you have multi-lines enabled and you go beyond the range of the visible text area.

Going to check out adding the image to the textbox background, that should be cool!


Diablo(Posted 2006) [#11]
Looking great so far, TextBox needs an scrollbar when you have multi-lines enabled and you go beyond the range of the visible text area.

Working on it...

Going to check out adding the image to the textbox background, that should be cool!

Or rather, textbox.ToggleDrawBackframe(false), for now.


Diablo(Posted 2006) [#12]
he,

Just this minute added:
textbox.SetBackgroundImage(image:TImage)


Zumwalt(Posted 2006) [#13]
LoL! By the way, I updated the textbox.bmx example and changed / added the following:

Local box:hi_TTextbox=hi_CreateTextbox("", 10, 10 + (24 * 0), 200, 200, True, Null)
box.ToggleDrawBackframe(0)


Where you just have hi_CreateTextbox=......
So basically ToggleDrawBackframe is setting the transparency of the textbox?


Diablo(Posted 2006) [#14]
If you like. :D

Cant think of a better way to word it.

Experiment is the key :D


Dreamora(Posted 2006) [#15]
Very good module diablo.


Diablo(Posted 2006) [#16]
thx Dreamora.

Update (minor)
--------------------------------
Update 4 [22/06/2006]: 
Fixed: Problems with Free() 
Added: hi_TTextbox.HasVScroll 


Get it here

Basicaly if you want a multiline textbox to show a scrollbar then go:

textbox.HasVScroll = true

After you have created it.

I will add Hscroll bars to textboxes soon, as well.


Diablo(Posted 2006) [#17]
Update 4a

+ Fixed: Problems with IsMouseOver()
+ Fixed: Memory leak - Many thanks to Yannis Deliyannis for this.
+ Added: SetTabIndex (index%)
+ Added: GetTabIndex% ()
+ Added: Flags Param to hi_CreateWindow and hi_TWindow.Create
+ Added: Flag - hi_TWindow.FLAGS_MINIMIZEBOX ' Sets if the minimize box is visible.
+ Added: Flag - hi_TWindow.FLAGS_FLAGS_KEEPINPARENT ' Makes it so the window can not be moved 
out the bounds of its parent.
+ Added: GetItems() to listboxes and comboboxes
+ Added: ClearItems() to listboxes and comboboxes
+ Added: OnClose (window:hi_TWindow) to hi_TWindow (windows)
+ Changed: Free method no longer returns a hi_TGadget (no use for it I can think of)


Get It Here

An example of using OnClose()
Import diablo.highgui

graphics ( 800, 600 )
SetMaskColor ( 255, 0, 255 )

hi_THighGUI.Init ( "../GUI/Themes/Windows/XP")

Global window_Main:hi_TWindow = hi_CreateWindow( "Window", 10, 10, 300, 300 )
window_Main.OnClose = window_FadeOut

Repeat

	Cls
	
	' Render / Update game
	' ...
		
	' Render / Update GUI
	hi_THighGUI.Render ()
	hi_THighGUI.Update ()
	
	Flip
	
	If hi_THighGUI.IsKeyHit ( KEY_ESCAPE ) Then End

Until AppTerminate()

Function window_FadeOut ( Window:hi_TWindow )
	
	Local done% = False
	Local a# = 1.0
	
	While not done
		
		Cls
	
		' Render / Update game
		' ...
		
		' Render / Update GUI
		hi_THighGUI.Render ()
		hi_THighGUI.Update ()
		
		a:- 0.1
		Window.SetAlpha ( a )
		
		Flip
		
		If hi_THighGUI.IsKeyHit ( KEY_ESCAPE ) or a < 0 or AppTerminate() Then done = True
		
	Wend
	
End Function



Kanati(Posted 2006) [#18]
can you limit the amount of text that can be entered in a textbox? I see a line limit, but not a character limit.


dynaman(Posted 2006) [#19]
Thanks Diablo!

If I ever get around to actually doing some programming in blitz I'll give this a try. (too much Oracle and VB work to do at the moment, and those two pay the bills)


Dreamora(Posted 2006) [#20]
This module is getting better and better.
I'm definitely planning to use it on my next project which is in need of an "ingame gui" to allow modification of the scenario in realtime while playtesting (somehow I got used to that due to TGB). But this needs that I finish my own needed base modules first :-)


Diablo(Posted 2006) [#21]
can you limit the amount of text that can be entered in a textbox? I see a line limit, but not a character limit.

No, you cant yet. This will be put on the next update list.

Thank's for the comments!


Abomination(Posted 2006) [#22]
Hi! ;)
It looks very good...
A few questions.
1). Is there a possibility to group gadgets together in something like a Panel?
2). Will it be possible to create a borderles- or transparant window?
3). During hi_THighGUI.Render() are you drawing ALL gadgets?
If so; could you add a parameter so the user can choose to redraw just the changed gadget(and its children).
4). During hi_THighGUI.Update() are you checking ALL gadgets?
If so; could you add a parameter so the user can choose to Not check the children if the mouse is not over the Parent-Gadget?


Diablo(Posted 2006) [#23]
1) I will add a pannel gadget.
2) It will be , note every gadget has a .setalpha (alpha).
3) Yes. I could do this - it seems it might make it faster. I'll look into it.
4) same as above :).

Thanks for the suggestions.


Tricky(Posted 2006) [#24]
FYI I tried this stuff and got a compiler error in this part:
	Function Render()
		
		UpdateGUIMouse()
		UpdateGUIKeys()
		
-->		hi_TGadget.list.Sort(True, hi_TGadget.CompareGadget)
		
		For Local gadget:hi_TGadget = EachIn hi_TGadget.list
			
			If gadget.visible And gadget.tabHidden = False Then gadget.Render()
			
			gadget = Null
			
		Next
		
	End Function


"Too many function parameters".
Tested in BlitzMax 1.18 for MacOS X
I placed a "--->" at the line the compiler was complaining about.


Diablo(Posted 2006) [#25]
I dont have a mac to test it on. Its probally because you need to download blitzmax 1.20 - I *think* that the second parameter was added in the newer version.

Edit:
Oh and please note - this module will only work with the latest itterations of blitzmax.


Tricky(Posted 2006) [#26]
Well if an error like "Too many function parameters" happens on a mac, then I can be 99% sure that it will happen on the PC, as well, since the Mac version and the PC version of BMax are almost identical. I may try an upgrade to V1.20 and try it again. (But I'm afraid of V1.20. Every time I installed it, something went horribly wrong).


Diablo(Posted 2006) [#27]
dont be afaird , BTW you would need 1.20:
+ (BRL.LinkedList) Added optional CompareFunc parameter to SortList



Tricky(Posted 2006) [#28]
Roger!
I'll make an update lateron ;)

===

Supplement.
Tried it works now.
Thank you ;)


Diablo(Posted 2006) [#29]
Glad to see you got it working :D

The new update is uploaded.

+ Added: lock and unlock to windows
+ Fixed: clipping problems with list/comboboxes
+ Added/Changed: Listboxes now scroll smoothly
+ Added: hi_TCreateBasic:hi_TGadget(x%, y%, w%, h%, parent:hi_TGadget) <- use this for pannels and grouping stuff together
+ Added: a character limit to textboxes (still havent tested this to the max)
+ Added: a line length limit to textboxes.
+ Fixed: A minior problem with hide (I hope X )


Get the update here

Sorry it took a bit longer then expected, I was sick for a while and was mostly just helping out ppl who email me.


Booticus(Posted 2006) [#30]
Thanks for the help via email Diablo! You're super cool to help us out! And thanks for the update!


Fry Crayola(Posted 2006) [#31]
I've just downloaded this for the first time, working with BlitzMax 1.22, and two of the examples don't work.

The ImageButton crashes when I hover over the button in question, with an "attempt to access field or method of Null object", highlighting the hi_THighGUI.Render() function call.

Secondly, when I type anything after selecting the TextBox, nothing appears on the gadget itself, and the debug output just outputs "0" for every key press.

Other than that, it looks a very, very good GUI module. May I ask about licensing restrictions?


Diablo(Posted 2006) [#32]
No licesing restrictions apply.

about the errors your getting, i'll see what I can do about them asap.


Diablo(Posted 2006) [#33]
Just uploaded a new update.

Update 6a
-----------------------------

+ Added: A color incoder to textboxes , if textbox.processColors = true then you can do the following:

textbox.addtext ( "bob #c255000000the#c000000255 builder#c255255255." )

and the word "the" should apper RED and the word "builder" should apper BLUE.

+ Fixed: minor issues with comboboxes.
+ Fixed: minor issues with image buttons.
+ Fixed: minor issues with textboxes.
+ Upgrade: There might be better performance when loads of gadgets are on screen.


Not much but hey :D im sure i did more just cant remeber.

Update is here Just click which every link suites you.

note color coder works in the format #c (begin color selection ) rrr ggg bbb. you want a color part less then 100 then type 050, 067, 011, etc.

I AM SURE I BORKED SOME STUFF SO MAKE SURE YOU BACK UP WHAT YOU HAVE ALREADY


Fry Crayola(Posted 2006) [#34]
Those two are working again. Can't argue with that!


Cruis.In(Posted 2006) [#35]
can I use this GUI to create a GUI for my game? For example if I have a graphic on the screen, which i want to make clickable, and then perform code ive written to happen when that button is clicked, or graphic, is this what I can do with this GUI??

I guess all im asking is similar to Getting Input from a user, if a user presses, "X" key, then do so and so... so am I right?


Diablo(Posted 2006) [#36]
You can do that.

I also created it to make small editors and similar stuff like that. In fact I used it to make a simple editor for a private project:



Even though there are lots of basic gadgets built-in you dont have to use any of them, You could just extend the Base gadget and start creating your own.


Fry Crayola(Posted 2006) [#37]
Hi, I tried to use .SetAlpha(x) just now, on a button and on a label, but it doesn't seem to be working. Has this been implemented yet or is it something for the future?

.SetColor works fine, which is good.

Edit: it seems that .SetTextAlpha(x), as well as working for labels (I didn't notice it at the time), also sets the alpha value of a button, turning the whole button transparent.


Diablo(Posted 2006) [#38]
wow, bug.

mmm I forgot a . in front of SetAlpha doh!

Well you can ethier wait for the next update or open highgui.mod/Button.bmx and change the line SetAlpha ( fColor[3] ) to .SetAlpha ( fColor[3] ).

And rebuild modules of course.


Fry Crayola(Posted 2006) [#39]
Aye, I'll probably do that until the next update. Thanks for that.


North(Posted 2006) [#40]
Would it be possible to use this with minib3d?
Could you please post an example of such a 'marriage'?


Diablo(Posted 2006) [#41]
Its totally possible.

Download this MiniB3D_n_HighGUI.zip

Extract it to your MiniB3D tests folder and then simply modifiy MiniB3D.bmx by replacing the line:

GLGraphics(width,height,depth,rate,GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER)

To:

SetGraphicsDriver (GLMax2DDriver())
Graphics (width,height,depth,rate,GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER)


Armitage 1982(Posted 2006) [#42]
This is definitely something to try out and i really hope this project will soon arrive to a RC cause Max need such cool complete ingame Gui.

Thanks for releasing this free and keep in good work Diablo ;)


North(Posted 2006) [#43]
Thank you Diablo,

thats something to digest over the weekend :)


Diablo(Posted 2006) [#44]
@North
No problem. It should work because someone else already asked if this was possible. If you have any more troubles just post or email and i'll get back asap.

@Armitage 1982
Thanks for the support :D


767pilot(Posted 2006) [#45]
Just have to add this is a fantastic library for the GUI and I have a great use for this in my game menu design.

Question, any idea why it sometimes takes several clicks for the button to be pressed or for the cursor to appear in the textbox?

Big thanks

Graham


Booticus(Posted 2006) [#46]
Yeah I noticed the clicking several times in a textbox to get the cursor to appear too. Glad I wasn't alone. I was gonna email Diablo....but then I lamed out and forgot. Thanks for reminding me!


Brucey(Posted 2006) [#47]
Isn't the textbox cursor to do with the 1-second on 1-second off thing?
Perhaps you are clicking when it is flashing off.

You'll also notice this when you move the cursor around with the keys.
I changed my version so that the cursor was always visible when "something happened" in the textbox.

The button-click thing I've never noticed.

Good work Diablo ;-)


Diablo(Posted 2006) [#48]
@gjpollitt, Botticus.

I think Brucey has the answer here. I will change it so that it's visible while type + when clicked + when moving cursor. Look back in a couple of weeks when i'll have the time.


Sean Doherty(Posted 2006) [#49]
Some thoughts:

I tooka a another look at HighGui 3 and here are a few comments:

1) One your website, I can't seem to get any of the gadget features to be displayed; the page just keeps loading with a contacting PayPal message?

2) The the scroll bar control, if you click on the scrollbar itself, not the buttons, the scrollbar does not move?

3) I would recommend you alter the design. At present, it seens that you have to keep track of every gadget as a varibles in order to determine if it has been clicked as so on. Below:

In my design, your create the controls using local variables that don't need to be used again except for the top level control (window, panel, or screen). Basically, I give each control a name and I ask the screen is the screen about the control as follows:

[source]
if m_pTPanel.IsClicked("exit_buttom") = true then
end if
[/source]

I actually started my GUI library similary to your design, but it seemed to be a manegment nightmire for larger screen. Perhaps people disagree, and yes this is slightly slower (but it is a GUI). That said, I would recommend the change to greatly simplify the code.

With the method I mention, if on the creation you don't create all the objects on the panel, you don't have to change your application update logic. If you ask a the Panel is an gadget that hasen't been created has been clicked it just returns false!

Thanks


Diablo(Posted 2006) [#50]
1) This is indeed a problem - I'll take a look when I get a free mo.

2) You should be able to drag the scrollbar about, I havent got the source at hand but if what you say is true then its a bug and will be fixed in the next update ( couple of weeks ).

3) In my RPG project I had a good design of how you could use the GUI lib in a farily large project. I'll write a lil document and mabey introduce the design into the code base its self.

-- Edit --
Oh and it only displays a screen shot of the gadget, so if you want to see what they look like:
Windows
Buttons
Picturebox
Canvas
Tabgroups
Listboxes
Combobox
Scrollbars
Labels
Tickboxes
Radiobox
etc. [more later :]


Brucey(Posted 2006) [#51]
I think he means that if you click on the non-scrollbar-button part of the scrollbar it doesn't act like a page-move/jump of the scrollbar, as it would on a standard gui scrollbar (where the buttons are a single-step move/jump) when you click on it.

whatever that bit is called ;-)


Sean Doherty(Posted 2006) [#52]
That is correct.


Diablo(Posted 2006) [#53]
oh k.

*Adds to list of things to do*


Sean Doherty(Posted 2006) [#54]
Double post.


Sean Doherty(Posted 2006) [#55]
Can HighGui do the following screen, in the style of the screen:



Basically, you select a starship component on the left (not shown) and a component from the scroll box on the right and press mount.


Diablo(Posted 2006) [#56]
Hi Sean,
Got the message. About the screen above: it should be doable, though mabey some it might require writting a custom control (*looks at that listbox*), which isnt that hard - just extend hi_TGadget.

Having said that I plan on adding a few more gadgets over the next few releases.

About that suggestion - I have already done somthing kinda similar in a project I was working on so mabey in next release.


Sean Doherty(Posted 2006) [#57]
Diable,

Any idea when the next release will be abailable? Also, would it be possible to use incbin for everything in the next release? At the moment, if you distribute a game using HighGui, you would have to include a directly for each of the files used to make up the style of the GUI.

It would be better to have the in the wrpped into the exe.

Thanks


Diablo(Posted 2006) [#58]
It'll be released when I have some time i.e. half term - about 3-4weeks.

Mabey i'll look into incbin graphics but it'll be an opt in beacuse some people might not want incbin graphics and incript/sercure their data differently.


767pilot(Posted 2006) [#59]
Can anyone give advice on the progressbar control



Using the above gives me an Expecting ')' but encountered ',' error.

I have looked for an example of the progress bar but the only example has mousex and mousey as 2 parameters. I dont understand why the above doesnt work.

I want it to display 5 out of 100.

Thanks
Graham


Diablo(Posted 2006) [#60]
healthbar.SetValue =(5,100)

remove the =

healthbar.SetValue(5,100)



Fry Crayola(Posted 2006) [#61]
Maybe i'll look into incbin graphics but it'll be an opt in beacuse some people might not want incbin graphics and incript/sercure their data differently.


An opt in would be perfect. I'm hoping to allow users to skin my game, so having incbins would defeat that purpose.


doswelk(Posted 2006) [#62]
How do you change the font a label uses?


Cruis.In(Posted 2006) [#63]
this looks great diablo, though i dont have a clue where to begin. :)

i want to make clickable controls for action with my ship in the game, open maybe a galaxy map...those sort of things.


Koriolis(Posted 2006) [#64]
Hi Diablo. I'm probably a bit late, but here we go: a big thank you to release a quality free GUI library.
I actually did not use it yet but know someone who does and appreciates the lib.
May I suggest a (big) improvment?
It seems (apologizes if I'm wrong, I've not looked much at the code yet) that you're updating every gadget at eacht rendering pass. What would be really, really great is to add an option to render each gadget (recursively) in its own image, allowing to update the display of only the parts that changed. If a gadget (could be a whole window) didn't change, you only display the unchanged image (used as a temporary buffer) for that gadget but don't update its content.
The memory usage would increase, but the on the other hand the rendering speed would be very stable no matter (well almost) how many gadgets you're displaying.

Just in case you have the time and will to implement that...
Would be great really.


Diablo(Posted 2006) [#65]
@doswelk
use Label.SetFont(URL:Object, Size% = 12, fStyle% = SMOOTHFONT)

@Cruis.In
Sounds like you should look at Buttons, The base gadget and Canvases. Look at the examples that come with the download.

@Koriolis
I'll look into this image idea, though Big Imporovments require time :D


siread(Posted 2006) [#66]
Speed doesn't seem to be an issue on lower resolutions but when working with a 1024x768 screen, a background image and some alpha gadgets things can get a bit sluggish. Button clicks aren't always caught and highlighting items can take a moment.

Or maybe I'm just coding badly. :P


Diablo(Posted 2006) [#67]
@siread
There could be many reson for this like hardware and such like but I know there is a lot I can do to increase performance so I will indevor to do those things :D


siread(Posted 2006) [#68]
Yeah, i tried the same program in my "big" pc and it ran smooth as silk. Still, it's only a few simple gadgets, so it shouldn't be too much trouble for my "little" pc. :)


Cruis.In(Posted 2006) [#69]
hi diablo.

i put diablo.mod in the /mod folder of blitzmax

Import diablo.highgui

Global test:Hi_TButton = hi_CreateButton("Exit Button", 500, 500, 500, 500)

	
	Hi_ThighGui.Render()
	Hi_ThighGui.Update()


i get an error similar to that reported by Fry Crayola, which I think he said you since fixed. But the app exits and says unable to access field or method of null object and is highlighting Hi_ThighGui.Render()

any ideas?


North(Posted 2006) [#70]
I ran into this alot when i tried to get HighGui and MiniB3D to work togehter and I think it might have to do with your gfx initialisation routine.

The null object typically should be of the type gadget and the error occurs in the basicsetup routine in the BaseGadget Type?

If so i'd be interested to hear more about this ^^


Diablo(Posted 2006) [#71]
um , wired.

Make sure you call hi_THighGUI.Init(themePath$) and give the path were all the graphics are containted.


Cruis.In(Posted 2006) [#72]
diablo, sorry I figured this might be the problem.

i didn't quite understand how to use the init, because i dont have a graphics theme, i thought the button was a default looking button which didn't need anything specified besides the button text, x,y,w,h paremeters.

that part could use a little explaining.


Cruis.In(Posted 2006) [#73]
I put your Xp theme in my graphics folder and called the init function with my path. so that stops the error on the render() part i mentioned above. But the button just quickly flashes and is gone again when i start up.

my render and update are in the loop and the variable i made to create the button is out of the loop.
could you make a simple tutorial? i dont understand why your example works.

i dont know diablo, i had the button at 500, everything x,y,w,h, i changed it to 200 now its fine... any ideas what I did wrong? button cant be bigger than certain pixels?


Dreamora(Posted 2006) [#74]
Great you finally added a donation link to the page :-)

Although I haven't used HighGUI for anything that I did not trash, I wanted to support something as good. Thank you for offering us this great ingame GUI.


Diablo(Posted 2006) [#75]
@ Cruis.in
The button should be able to be any size.
Here is some striped down code, tell me if this works and also post you'r code if you still get bugs:
SuperStrict

' Import HighGUI
Import Diablo.HighGUI

' Sets a application title
AppTitle = "HighGUI 3: Gadget Example - Buttons"

' Create a graphics context of width 1024 and height of 768
Graphics(1024, 768, 0)

' Set the mask color to PINK
SetMaskColor(255, 0, 255)

' Set the path used by highgui and also load graphics
' This dosent use any default graphics, however 2 themes are given 
' highgui - just copy the theme folder to your source directory.
hi_THighGUI.Init("../Themes/Windows/XP")

' Create a basic button at 500, 500 and of size 500, 500
Global test:Hi_TButton = hi_CreateButton("Exit Button", 500, 500, 500, 500)

' Is the app still running?
Global running% = True

' Show the mouse ( bmax command )
ShowMouse()

' The MAIN LOOP ;D
Repeat
	
	' Clear the screen
	Cls

	' Update and render highgui
	hi_THighGUI.Render()
	hi_THighGUI.Update()
		
	' Flip the buffers
	Flip
	
	' Some condidtional exits
	If KeyDown(KEY_LCONTROL) And KeyDown(KEY_X) Then running = False
	If AppTerminate() Then running = False
	
Until Not running ' Continue until running dosent = true


Expected result:
A button in the bottom right of the screen will be rendered every frame.

EDit:
@Dreamora

Hehe, its been there a while now ;D


Fry Crayola(Posted 2006) [#76]
I was playing about with buttons and groupboxes, and came across an oddity.

If I have a groupbox which is 500 pixels wide, and place a 100-pixel button at 450,10 in that box (as a child of the groupbox), half of it gets cut off. Exactly as I had hoped.

However, the text of that button doesn't get cut off, it trails off the edge of the half-button and group box, sticking out into the nothingness that is the rest of the screen. Ideally it would also be cut at the same point that the button is cut.

Hope that's clear.


Diablo(Posted 2006) [#77]
Sounds like a clipping problem, which is good for me because they are normally an easy fix (moving code about).


Cruis.In(Posted 2006) [#78]
everything working good now diablo. :) thanks
sorrry for trouble.

I think just having problems, figuring out where to put certain things since this is my first time working with a GUI. I mean in terms of like, the button not being in the actual loop code. etc etc...

one thing that has me, is the code function and use and paremeters are well documented. but the other things are not.

like buttons, canvases, tab groups. like what does what for what I want. like groups of buttons, button when clicked , changes the display of a video display box... which one of those items would be the box, and what would be used for the things inside the box.

also, i am using your xp theme. do i just replace the graphics of each of those things with set image?


Sets the image of the button. If you dont give an image for a state then normal will be used.


when you say normal, you mean the normal for the current theme you are using? Do I have to load a theme at all, or can I just put nothing for the init, meaning something that loads nothing, so the function has the parameter, but so it wont do anything.


that sort of stuff heh.


Diablo(Posted 2006) [#79]
when you say normal, you mean the normal for the current theme you are using? Do I have to load a theme at all, or can I just put nothing for the init, meaning something that loads nothing, so the function has the parameter, but so it wont do anything.

Yes.

I will eventually get round to writing some form of tutorial one day and when that day cometh it will solve your problem of not knowing how to do simple tasks. Until then feel free to ask all the questions you like and i'll do my best to answer them :D


Cruis.In(Posted 2006) [#80]
gee thanks diablo, i thought i was annoying which is why i mentioned general tutorial.

i think ill be good once i get two things explained. i only asking so i dont have to end up doing over an interface.

i show you what I want. take a look at this picture.


the little squares at the top are buttons. When these buttons are pressed, the display inside the box will change. So for those buttons, I use hi_button :)

what to use for the box, where all that information is explained in?

those four rectangles inside the view box, have locks to the right. the locks would be buttons. so all these things must belong to a group?

also when I click the button tabs above, to change what is displayed in the window, do i put a new window, and have how ever many windows as per button, so that when I click one, a window comes to the top? this sounds best, so that all windows are there drawn on each other, but as i click a button, a different window comes to the front.

right? :)

maybe a brief thing like a small explanation next to the features is good.

like canvases- this is a window looking object, good for use with dogs...

you get the idea... :)


Fry Crayola(Posted 2006) [#81]
Hi Diablo,

Regarding that clipping problem, the text is displayed even if the button is completely outside the bounds of the GroupBox, whereas the button is hidden. So it seems that the text isn't recognising the same restrictions on graphics.


I have another question now. I've created a small piece of code, which you can see below. There's an odd problem with it, however. The framerate remains steady until I click the mouse (regardless of its position) at which point the FPS vary depending on where the mouse is.

If the mouse is in the black screen area, the framerate is at its lowest. If the mouse hovers over the top left button that says "Itemo!", it's at its highest. Hover the mouse over the bottom right button that says "Uh-oh!", and it's low.

Could this be something to do with how the system tests each gadget? It would seem to me that when I hover outside the blue groupbox, the system is searching every gadget because it can't "rule anything out", so to speak.

Whereas if I'm inside a box, it can rule out anything that's not a child of that box, and it likes the top left gadget better than the bottom right because that's the order I've created them, from top to bottom like one would write, finishing one line before moving on.

This is just a theory, I haven't gone through the code.

Edit: Oops, forgot the code!

Rem

	HighGUI 3: Gadget Example - Buttons
	====================================
	
EndRem
SuperStrict
Rem
	
	Framework + Imports
	
endrem
Framework Brl.Max2D
Import Brl.D3D7Max2D
Import Brl.GLMax2D
Import brl.FreetypeFont

Import Diablo.HighGUI

Incbin "../../Gfx/background1.png"

SeedRnd(MilliSecs())
AppTitle = "HighGUI 3: Gadget Example - Buttons"

SetGraphicsDriver(GLMax2DDriver())
Graphics(1024, 768, 0)
SetMaskColor(255, 0, 255)

hi_THighGUI.Init("../Themes/Windows/XP")

Local panel1:hi_TGroupBox = hi_CreateGroupBox("", 0, 0, 500, 658, Null)
panel1.SetColor(51, 51, 255)

hi_CreateButton("Button Man!", 250, 10, 100, 25, 0, panel1)

Local panel2:hi_TGroupBox = hi_CreategroupBox("", 10, 10, 300, 400, panel1)
panel2.SetColor(255, 255, 240)
panel2.SetAlpha(0.9)

'header
hi_CreateButton("Header", 5, 0, 90, 20, 0, panel2)
hi_CreateButton("Works!", 100, 0, 90, 20, 0, panel2)

For Local count:Int = 0 To 11
	hi_CreateButton("Itemo!", 5, 30+(30*count), 100, 25, 0, panel2)
	hi_CreateButton("Goodo!", 105, 30+(30*count), 100, 25, 0, panel2)
	hi_CreateButton("Uh-Oh!", 210, 30+(30*count), 100, 25, 0, panel2)
Next


Global running% = True

SetBlend(ALPHABLEND)
ShowMouse()

Repeat
	
	Cls
	PollSystem
	
'	DrawImage background, 0, 0
	
	hi_THighGUI.Render()
	hi_THighGUI.Update()
	
	SetColor 0, 0, 0
	DrawText "FPS = " + TFPSCounter.FPS, 11, 600 - GetImageFont().height() - 1
	SetColor 0, 173, 0
	DrawText "FPS = " + TFPSCounter.FPS, 10, 600 - GetImageFont().height() - 2
	SetColor 255, 255, 255
	
	Local mem% = GCMemAlloced()
	SetColor 0, 0, 0
	DrawText "Mem = " + mem, 11, 600 - (GetImageFont().height() * 2) - 1
	SetColor 0, 173, 0
	DrawText "Mem = " + mem, 10, 600 - (GetImageFont().height() * 2) - 2
	SetColor 255, 255, 255
	
	Flip 0
	
	TFPSCounter.Update()
		
	If KeyDown(KEY_LCONTROL) And KeyDown(KEY_X) Then running = False
	If AppTerminate() Then running = False
	
	GCCollect()
	
Until Not running

Type TFPSCounter
	
	Global FPS%, frameCounter%, frameTimer%, totalFrames%
	
	Function Update()
		
		frameCounter:+ 1
		totalFrames:+ 1
		
		If frameTimer < MilliSecs()
		
			FPS = frameCounter
			frameTimer = 1000 + MilliSecs()
			frameCounter = 0 
			
		EndIf
		
	End Function
	
End Type



Diablo(Posted 2006) [#82]
thats about how it dose it atm. I'll take your code as a point of referance for speeding things up. Ty.


Fry Crayola(Posted 2006) [#83]
Correct me if I'm wrong, but there doesn't seem to be a method to completely wipe a textbox... is this right?

I'm not entirely sure how to get around it on a multiline text box. I can do it fine on a single line one by using SetLineText(0, "").

Similarly, a method to set the contents of the textbox might be useful although again for a single line, SetLineText does all I need whereas a multiline one would be more complex unless you want to work with control codes in the string.

Anyhow, back to play with scrollbars and see what I can do!


Cruis.In(Posted 2006) [#84]
diablo, small problem.

a button is being drawn at different place than where the clicking works
I have setorigin gwidth/2-shipx, gheight/2-shipy

to keep the ship in the centre of the screen as it goes about the game world. so the button is being drawn at 100 from the shipx and y which is 612 and 484, but is really at 100,100 on the screen, so when I click in the vincinity of 100,100 on the screen, the button presses, and the code i have set to execute, does so.

how do i get around this? i tried putting set origin in your highgui.bmx in the render, but no work.

im also having to push a button twice to get the code to run. first push does nothing, second push works.

i have 2 windows, one button brings the other one above it, bringtotop()
If test.IsPressed() 
	windows.bringtotop()
	End If 	
	
	If test2.ispressed()
		windows1.bringtotop()
	End If



the render and update are in the loop as usual, and the windows draw correctly, and do what i want when the button is clicked the second time.

it works if i put

If test2.ispressed()
		end
	End If


it exits on one click. changed nothing else. whats up there.


Cruis.In(Posted 2006) [#85]
setting the drawframe parameter to null with a call to setimage for a button, doesn't work. says identifier drawframe not found.

its a default parameter set to false, but you said in the help file if you change it to null, then the width and height of the button becomes the width and height of the image specified


Cruis.In(Posted 2006) [#86]
Diablo, i want to do what you did in the example picture you posted in your first post of this thread.

the bottom most window which has button 2.

And the tabs above it.

i want to be able to click tabs like that for a window i have, and the window then display different buttons.
so the first window the default would have 5 buttons which do 5 different things, and when i push tab two, that goes away and is replaced by another window in the same area which has its own buttons. this is what I want.


Diablo(Posted 2006) [#87]
@Fry Crayola
Yea - Helper functions are on the to-do list.

@Cruis.In
Look at tabgroups; if i'm correct this is just what you want.

Rem

	HighGUI 3: Gadget Example - TabGroups
	====================================
	
EndRem
SuperStrict

Rem
	
	Framework + Imports
	
endrem
Framework Brl.Max2D
Import Brl.D3D7Max2D
Import Brl.GLMax2D
Import brl.FreetypeFont

Import Diablo.HighGUI

Incbin "../../Gfx/background1.png"

SeedRnd(MilliSecs())
AppTitle = "HighGUI 3: Gadget Example - TabGroups"

SetGraphicsDriver(GLMax2DDriver())
Graphics(800, 600, 32)
SetMaskColor(255, 0, 255)

hi_THighGUI.Init("../Themes/Windows/XP")

Global background:TImage = LoadImage("incbin::../../Gfx/background1.png")

' First of create the tabgroup
Global tabgroup:hi_TTabgroup = hi_CreateTabgroup(10, 10, 600, 500)

' Now create an array of pages ** These are going to be parents to other controls **
Global tabpage:hi_TTab[10]

' Easy ¬.¬
tabpage[0] = tabgroup.AddTab("Tab Page One")
tabpage[1] = tabgroup.AddTab("Tab Page Two")
tabpage[2] = tabgroup.AddTab("Tab Page Three")
tabpage[3] = tabgroup.AddTab("Tab Page Four")
tabpage[4] = tabgroup.AddTab("Tab Page Five")
tabpage[5] = tabgroup.AddTab("Tab Page Six")
tabpage[6] = tabgroup.AddTab("Tab Page Seven")
tabpage[7] = tabgroup.AddTab("Tab Page Eight")
tabpage[8] = tabgroup.AddTab("Tab Page Nine")
tabpage[9] = tabgroup.AddTab("Tab Page Ten")

' To add gadgets just do a normal gadget createion - BUT use tabpage[pagenumber] as a parent so e.g.
hi_CreateButton("Button 1 : Normal", 10, 10 + (24 * 0), 200, 22, hi_THighGUI.BUTTONSTYLE_NORMAL, tabpage[0], 0)

Global running% = True

SetBlend(ALPHABLEND)
ShowMouse()

Repeat
	
	Cls
	
	DrawImage background, 0, 0
	
	hi_THighGUI.Render()
	hi_THighGUI.Update()
	
	SetColor 0, 0, 0
	DrawText "FPS = " + TFPSCounter.FPS, 11, 600 - GetImageFont().height() - 1
	SetColor 0, 173, 0
	DrawText "FPS = " + TFPSCounter.FPS, 10, 600 - GetImageFont().height() - 2
	SetColor 255, 255, 255
	
	Local mem% = GCMemAlloced()
	SetColor 0, 0, 0
	DrawText "Mem = " + mem, 11, 600 - (GetImageFont().height() * 2) - 1
	SetColor 0, 173, 0
	DrawText "Mem = " + mem, 10, 600 - (GetImageFont().height() * 2) - 2
	SetColor 255, 255, 255
	
	Flip 0
	
	TFPSCounter.Update()
	
	If KeyDown(KEY_LCONTROL) And KeyDown(KEY_X) Then running = False
	If AppTerminate() Then running = False
	
	GCCollect()
	
Until Not running

Type TFPSCounter
	
	Global FPS%, frameCounter%, frameTimer%, totalFrames%
	
	Function Update()
		
		frameCounter:+ 1
		totalFrames:+ 1
		
		If frameTimer < MilliSecs()
		
			FPS = frameCounter
			frameTimer = 1000 + MilliSecs()
			frameCounter = 0 
			
		EndIf
		
	End Function
	
End Type



About the origin problem. the collision code doesn't check origin atm, I'll see what can be done.


Cruis.In(Posted 2006) [#88]
thanks a lot for that example diablo

heres what ive done.

Global tabgroup1:hi_ttabgroup=hi_createTabgroup(0,568,200,200)
Global tabgroup2:hi_ttabgroup=hi_createTabgroup(0,568,200,200)
Global tabgroup3:hi_ttabgroup=hi_createTabgroup(0,568,200,200)
Global tabgroup4:hi_ttabgroup=hi_createTabgroup(0,568,200,200)


'where the buttons are (just above the interface box)
Global tab1:hi_tbutton = hi_createbutton("tab", 20, 553, 40,30)
Global tab2:hi_tbutton = hi_createbutton("tab", 60, 553, 40,30)
Global tab3:hi_tbutton = hi_createbutton("tab", 100, 553, 40,30)
Global tab4:hi_tbutton = hi_createbutton("tab", 140, 553, 40,30)



'bring back ship icon, dim out other screens, remove ship power rects
	If tab1.ispressed()
		show_power=False
		ship_display = True 
		tabgroup1.show()
		
				
		tabgroup1.setalpha 0.5	
		tabgroup2.hide()
		tabgroup3.hide()
		tabgroup4.hide()
	End If 
	
	
	'draw rects, by ship-power = true... bring him to top with his buttons etc.
	If tab2.ispressed()
		tabgroup2.show()
		ship_display = False		
		show_power = True
				
		tabgroup2.setalpha 0.5
		
		tabgroup1.hide()
		tabgroup3.hide()
		tabgroup4.hide()
	End If


so i created 4 tabgroup things. and created 4 buttons above them, so when i click one button it hides the rest other than the one i want showing. as you can see with my input code there.

but i guess your way is easier! ROFL

couple things setting the drawframe parameter to null with a call to setimage for a button, doesn't work. says identifier drawframe not found.


any idea there?

also

Global increase_Wpower:hi_tbutton = hi_createbutton("", 150, 600, 20, 20)
Global increase_Spower:hi_tbutton = hi_createbutton("", 150, 638, 20, 20)
Global increase_Epower:hi_tbutton = hi_createbutton("", 150, 678, 20, 20)
Global increase_Xpower:hi_tbutton = hi_createbutton("", 150, 718, 20, 20)



using my old way with some increase power buttons

i tried setting image

'set the image of the + button. of the increase power buttons above
	increase_Wpower.setimage(plus_button)
	increase_Spower.setimage(plus_button)
	increase_Epower.setimage(plus_button)
	increase_Xpower.setimage(plus_button)


it works, but now when i press those buttons they disappear and when i let them go they come back.
i put the image to be the same size as the button. 20 * 20

any idea for that one?


Cruis.In(Posted 2006) [#89]
one thing, i put a setorigin 0,0 just before your render and update commands, to solve the problem i am having, but the other setorigin command is a few commands above in the loop.

i thought it must be offsetting how the buttons are working, because your stuff is fine in your example, but i have to click my tabs for my tab group a lot to get them to actually click.

but then i took off all set origin commands

and have the interface there as normal, but it still does the same thing, requires multiple clicks....

meaning i switched over to your way, but i have to click between the tab i want to go to multiple times before it switches.

almost got this one ironed out by putting render and update up close to CLS at the top of the loop. seems to help.

next thing now

i have my interface done your way with tabs, but when i initially start, nothing is in tab1, even though a picture box and progress bar are parented to there. So I then click tab2, which has 8 buttons in it and nothing shows up, I have to click inside the tabgroup itself(or now really inside the current tab page) to get those things to show up. Then same thing for tab page 1,

and THEN when i click between the tabe pages, the buttons and picture boxes show up and go away as normal as I switch between tabs....

any ideas?
here is the code

Global tabgroup:hi_ttabgroup = hi_createTabgroup(0,568,200,200)

Global tabpage:hi_TTab[4]

tabpage[0] = tabgroup.addtab("Ship Status")
tabpage[1] = tabgroup.addtab("Power Status")
tabpage[2] = tabgroup.addtab("Damage COntrol")
tabpage[3] = tabgroup.addtab("4")


'=====================================
'BUTTONS TO INCREASE POWER TO A SYSTEM
'=====================================


'graphics for the plus button
Global picture:hi_tpicturebox = hi_createpicturebox(defiantgrey, 35, 600)
picture.togglenoborder(1)
picture.setparent(tabpage[0])

' PLUS (+) buttons for the power display in tab page 2 (power management) 
Global increase_Wpower:hi_tbutton = hi_createbutton("", 150, 600, 20, 20)
Global increase_Spower:hi_tbutton = hi_createbutton("", 150, 638, 20, 20)
Global increase_Epower:hi_tbutton = hi_createbutton("", 150, 678, 20, 20)
Global increase_Xpower:hi_tbutton = hi_createbutton("", 150, 718, 20, 20)

 
'set these buttons parent gadget to be tab page 1. 
'=============================================================================
' + BUTTONS
increase_Wpower.setparent(tabpage[1])
increase_Spower.setparent(tabpage[1])	
increase_Epower.setparent(tabpage[1])
increase_Xpower.setparent(tabpage[1])

'progress bar beneath picture box
Global progressbar:hi_tprogressbar = hi_createprogressbar(40,735,100,10)
progressbar.setparent(tabpage[0])


nothing shows up on execution.
and have to click in the tab page box area itself below the tabs to get the picture box there, and the progress bar to show.


Diablo(Posted 2006) [#90]
couple things setting the drawframe parameter to null with a call to setimage for a button, doesn't work. says identifier drawframe not found.



any idea there?


SetImage(normal:Object, over:Object = Null, down:Object = Null, active:Object = Null, disabled:Object = Null, DrawFrame% = False)

It just means that if you set the last parameter to the method false - it should auto resize. It probally doesn't but it sould :/.

about the dissapering buttons, trying setting all the image parameters to not null e.g.:
increase_Wpower.setimage(plus_button, plus_button, plus_button, plus_button, plus_button)
increase_Spower.setimage(plus_button, plus_button, plus_button, plus_button, plus_button)
increase_Epower.setimage(plus_button, plus_button, plus_button, plus_button, plus_button)
increase_Xpower.setimage(plus_button, plus_button, plus_button, plus_button, plus_button)

[i]This is a major wast of memory so I'll get this fix for next update.

This is hard because I just re-installed windows and havent got round to installing blitzmax or copying my backups.

any ideas?

try this for now. I think that tab pages dont make any page active to start with , which is a bit silly :(
tabgroup.activeTab = tabpage[1]

Helper methods for this stuff will be added in due course (which is when ever I can)

And I really have to say a big thankyou to Cruis.In your helping me think of a lot of things to make this GUI rock, ty.


Cruis.In(Posted 2006) [#91]
what???? no one has ever said thank you to me for asking annoying questions...

thanks alot!!!!!!!!!!!!!!!!!

btw I wanted to explain to you my way I did it above, with the 4 tab groups. Basically I was using draw rects to display things such as ship hull, power bars for various systems, but tabgroups are opaque. so i had it set when I pushed the button that the other tabgroups became hidden and the current one was alphaed. so you could see its buttons, its picture boxes, but then also see my draw rects behind.

that was the idea back then
since then ive got picture boxes in without quirks now, so the picture of ship in the display is a picture box now.
and ive switched to using progressbars for my drawrects. you thought of so much when doing this, because with

progressbar.setvalue()
it calculates the percentage of the two, so if i put 10,20,

its 50 percent full, same as 50,100)
so i put 100 for the last one, and the variable for the power i want displayed.

so say setvalue(hull strength, 100)
and hull strength starts as 100, so its full and goes down gradually.

Love it.

i actually thought of making them active on starting, will let you know if it helps.

and with drawframe it was myfault. the way you have help i thought you had to put, drawframe= false

but you just have to follow the parameter order, enter everything and when you get there drawframe is put false. then it works great.

now here's a bug i think i encountered.

since putting
render()
update()

in the main loop or maybe its the hi thighgui init in the loop, anyway since using High Gui, this quirk has happened.

i had that when you pressed and hold shift THEN hit C it cloaks the ship. now you have to press and hold C first then hit shift. its reversed

also normal if keyhit(KEY_whatever) doesn't work either.

so all my keys are disabled. P = arm weapons, no work, tab = go to hyper speed, no work.

take out render() update() and they work.
do you think that it is because I am using polled input, as opposed to your event input?

any idea?

I'd like a setbackground for the tabgroup box too :) which gets drawn underneath everything else of course


Diablo(Posted 2006) [#92]
Input problems:

Try using my functions and it should work - It because of how input is done in the gui lib so use ...
hi_THighGUI.IsKeyHit(key%)
hi_THighGUI.IsKeyDown(key%)
hi_THighGUI.IsKeyPressed(key%)

same for mouse , though I dont think thats effected.

Set backgrounds for most gadgets will *hopefullly* be added for the next update.

of course dont forget that you can just edit the theme graphics.

FYI: This gui doesn't use event input ;)


Cruis.In(Posted 2006) [#93]
oh

whats different between iskeyhit

and iskeypressed?

before I go replacing all my input code, you sure you dont got any suggestions to fix that problem?

want to see my interface? it aint pretty, cause the graphics are done in paint, but its functional and intuitive and the gfx can always be done and replaced.

need a 2d artist. :)
:)


Booticus(Posted 2006) [#94]
Hey I want to see your interface Cruis.In! Im on a hiatus from my project that uses HighGUI but I'm ready to jump back in with it and have followed thris thread with interest!


Cruis.In(Posted 2006) [#95]
please dont laugh ok, its got graphics from paint.

and not finished. :)

in all I probably have 12 buttons, 6 progress bars, 8 icons.

lots of code for this stuff but i set the parent for these things separate and not in the function call, dont like long lines of code :)

and do most things to the buttons or progress bars, instead of in the function call to make them. so many lines. but easy :)

this thing get 100/100 for ease of use. I didn't pay for it and diablo is there with great support for annoying me. i am so annoying... always asking about stuff.

please forgive my ugly, debugging, testing build here :)
notice the ugly button there marked ship LOL






there ya go!


Booticus(Posted 2006) [#96]
Dude! Thats pretty slick looking! I forgot, in HighGUI how do you scroll those tabs down there in the lower left? The Power Status, Damage, etc.?

About you being annoying, you're braver than I am. I email Diablo directly. You've inspired me to ask questions in the forums for HighGUI so hopefully other fraidy cats like me will jump in too. :)


Cruis.In(Posted 2006) [#97]
you scroll them with the arrows in the top right of the box. i have my tabgroup on alpha so they might not be too visible.

the shield thing around the ship is supposed to be replaced with arcs of course. they are also buttons, so when you click them, it reinforces that shield.


Diablo(Posted 2006) [#98]
before I go replacing all my input code, you sure you dont got any suggestions to fix that problem?

I have tried to but no luck so far. It's because of keyhit.

The differance is that the key state checks are made on the call to update and then when you call iskeyhit, etc. it just checks the state from an array.

edit: actually give me till sometime tomorrow, I'll have another look.


Cruis.In(Posted 2006) [#99]
ok i look forward to your response.

alpha release delayed to wednesday @ 11p.m


Diablo(Posted 2006) [#100]
Right, I hope its finally fixed:

What you need to do is simple.

Open up HighGUI.bmx and find the following function:

Function UpdateGUIKeys()


now replace all the code in the function with:
keyStack.Clear()
		
		For Local i% = 1 To 226
			
			If keyState[i] = 2 And KeyDown(i) = False Then 
				keyState[i] = 3
			Else
				If keyState[i] = 3 Then keyState[i] = -1
			EndIf

			
			If KeyDown(i) Then 
			
				If Not KeyInStack(i, keyStack) Then 
	 			
					keyStack.AddLast String(i)
					
				EndIf
				
				If keyState[i] = -1 Or keyState[i] = 0 Then 
				
					keyState[i] = 1
					Exit
					
				End If
				
				keyState[i] = 2
				
			EndIf
		
		Next
		
		curGetKey = GetChar()


then rebuild the mod.

I hope this fixes it, I did a small amount of testing first so make sure you backup.

Oh and I shall be releasing a full update somtime this weekend I hope.


Fry Crayola(Posted 2006) [#101]
Any chance of a hint as to what's in the update?

I'm looking to see if I can create a custom gadget that will create a scrollable area into which I can place any other gadgets, and scroll using scrollbars.

But I'd hate to be doing anything that you're planning to release.


Diablo(Posted 2006) [#102]
I'm looking to see if I can create a custom gadget that will create a scrollable area into which I can place any other gadgets, and scroll using scrollbars.

I was planning on adding this so you can scroll controls.

Mainly I'll just be adding helper functions and hopefully performance increases.

And I'll see what I can do about that incbin thing and a few other suggestions up there.


Cruis.In(Posted 2006) [#103]
Diablo. if these are in already, or there is something else that would do what I want, or a gadget that is for what I want then dont be mad :)

Progress bars. ability to set image. so i can replace your black outline thing with a cool looking image, and the progress bar becomes the size of the image as with .setimage for buttons. Of course the image I make would be transparent in the center so you can see the green progress thingy.

so progressbar1.setimage(yourimage)
?


also for tabgroups. perhaps tabgroup.setimage ?

so that you can make the tabgroup like an image of whatever, instead of the white box is forms with.

I know you plan to include set background, but the tabgroup would still basically be a sort of square box right? perhaps as the same with button.setimage you could make the tabgroup become the shape of the image you set. So if you set a blue circle with a black background, you'd have your interface now in a blue circle instead of a general box thing.

just some things off the top of my head.


thanks for the input fix, will let you know when i go home! what you mean to back up? the highgui.bmx?

i still have the download.


Cruis.In(Posted 2006) [#104]
my rebuild all models is greyed out....


Diablo(Posted 2006) [#105]
http://blitzmax.com/Community/posts.php?topic=53442

I would build it for you , but I cant get it to work on vista atm so I cant do much till I get home which is somtime tomorrow.


Cruis.In(Posted 2006) [#106]
i never built it in the first place. i just jucked your mod in the mod folder, could this cause problems? or it doesnt matter. why do I need to rebuild if i change the source code you mentioned in the file?

dont get the rebuild models thing.


Fry Crayola(Posted 2006) [#107]
Modules are basically pre-built chunks of code that you can use in your program. BlitzMax itself consists (almost) entirely of modules.

When you Import HighGUI, all you're doing is telling the compiler to include that pre-built code in the executable. If you make changes to the source code, it doesn't make the changes in that pre-built code until you rebuild the module.


Cruis.In(Posted 2006) [#108]
even on the windows platform?


Fry Crayola(Posted 2006) [#109]
On any platform.

Modules are essentially a way of cutting down on compile time, as well as proving you with distinct chunks of functionality, be it a database, an xml library or a GUI.

Generally, these don't change regularly. Once one is "set in stone", so to speak, it'll rarely get tweaked. So instead of having to compile it every time you write a program that uses it, you can compile it once and have it included in any other executable.


Cruis.In(Posted 2006) [#110]
well why does blitzmax require a whole bunch of other stuff, mingw, just to rebuild it.

i replaced the gui code, using find/replace, instead of rebuilding. :)


Cruis.In(Posted 2006) [#111]
diablo can you rebuild it and put the file i need to redownload... would that help me?


Cruis.In(Posted 2006) [#112]
hence why it is a module, and uses import command, and not include, because include just includes written code and compiles it again each time.

which means after your game is done in certain parts and you know for sure you wont change them anymore, though most of the time this isnt possible, you could make some stuff modules, so as to cut down on compile time for large projects.


Diablo(Posted 2006) [#113]
Btw the way sorry for the long wait so far. Having major problems with my host server. ie I connot upload a dam thing :<.


Cruis.In(Posted 2006) [#114]
i rebuilt all models diablo, but the keyhit stuff doesnt work still.

might be interesting to note, keydown's work, but keyhits dont....


Koriolis(Posted 2006) [#115]
Diablo, I think I found the main cause of the poor speed I (and others) have experienced with HighGui.
The culprit is in hi_TGadget.IsIn().
I made some very limited changes, but with a major impact on the speed : for a test in windowed mode with 5 rows of 25 textboxes, my FPS has gone from 1 FPS (!) to 60.
Needless to say, that makes a huge difference regarding the usefulness of the lib.

Just replace the implementation of IsIn with the following code:
		Method PointInView_%(x%, y%, recursive%=True)
			If Not visible Or Not hi_TRect.PointInRect(x, y, Self.x, Self.y, Self.w, Self.h) Then
				Return False
			Else
				If parent <> Null Then
					' Check that the point is not hidden by a sibbling gadget with a higher z order
					If parent.childList <> Null Then
						For Local gadget:hi_TGadget = EachIn parent.childList
							If gadget.z > Self.z And gadget.visible And ..
								hi_TRect.PointInRect(x, y, gadget.x, gadget.y, gadget.w, gadget.h) Then
								Return False							
							EndIf
						Next
					EndIf
					
					If recursive Then
						Return parent.PointInView_(x, y, recursive)
					EndIf
				Else
					Return True
				EndIf
			EndIf
		End Method
		
		Method FindTopMostAncestor:hi_TGadget(includingSelf%=False)
			If parent = Null Then
				If includingSelf Then
					Return Self
				Else
					Return Null
				EndIf
			Else
				Local res:hi_TGadget = Self
				While res.parent <> Null
					res = res.parent
				Wend
				Return res
			EndIf
		End Method
		
		Rem
			bbdoc: Check if a point is in the gadget
		endrem
		Method IsIn%(x%, y%)
			
			'If Not visible Then Return False
			If disabled Then Return False
			
			' Check that the point is in view, without taking into account unrelated gadgets
			' (but taking into acoount siblings and parents)
			If Not PointInView_(x, y, True) Then
				Return False
			EndIf
			
			' Now check unrelated gadgets
			Local topMostGadget:hi_TGadget = FindTopMostAncestor(True)
			For Local gadget:hi_TGadget = EachIn list
				
				If gadget <> Self And gadget.parent = Null And gadget.z > topMostGadget.z Then
					'If gadget.IsIn(x, y) Then
					If hi_TRect.PointInRect(x, y, gadget.x, gadget.y, gadget.w, gadget.h)
						Return False
					EndIf
				EndIf
								
			Next
			
			Return True
		End Method


I'll let you do your own checks of the validity of my correction (admitedly I wrote it quickly and haven't tested it extensively, but I'm rather confident).
If it could end up in the next release, that would be great.

Now that I can actually use the lib, thanks one more time for writing it.


Koriolis(Posted 2006) [#116]
I'd also like to do some feature request:

The function pointers On*** in the gadgets are far too limited for me, as they take no parameter. What I'd like is that they take as parameter the source gadget.
Add to that an 'extra' field in hi_TGadget (Field extra:Oject) to store whatever user data I'd want to associate with the gadget (by example the instance of my very own type that the agdget belongs to, and on which I want to act in the event handler), and you will have a very decent event system.
Thanks in advance.


Diablo(Posted 2006) [#117]
@Koriolis
Your a legend :D

I'd also like to do some feature request

I'll add that in.

Many thanks.

Now, when I can start uploading stuff again I'll add these features into the update.


Cruis.In(Posted 2006) [#118]
dont forget the fixes for the stuff you mentioned earlier up to me. :)


Koriolis(Posted 2006) [#119]
Great :)


Diablo(Posted 2006) [#120]

dont forget the fixes for the stuff you mentioned earlier up to me. :)


Of course not, got all suggestions written down in a txt file ( erm someware round here ;)


Cruis.In(Posted 2006) [#121]
cool. did i mention, or is there a way currently ( dont see any) to set alpha of a button?

reason is I added a shield arc in my interface as a clickable button, so when you click it i want to be able to reinforce that shield, so i want them to get dimmer as they take damage etc... so i need to be able to alpha em :)


Diablo(Posted 2006) [#122]
Yea there should be. Every gadget has a .SetAlpha (), so
myGadget.SetAlpha(0.5) etc, will work on most gadgets.


Koriolis(Posted 2006) [#123]
BTW, I think that once the modifications are integrated and a new build is released, you shouldn't hesitate to pimp a lot about the speed boost. The speed was for my part the only major concern I had with HighGui 3 and I'm pretty sure some may have lost interest in the lib for this very same reason. They'll probably change their mind now.


siread(Posted 2006) [#124]
I'm having a problem with a Textbox. I use the following...

Global inpLobbyChatbox:hi_TTextbox = hi_CreateTextbox("", 10, 590, 780, 200, True, Null)


But when I run the program i get an error in max2d.bmx:
"Unhandled exception: Attempt to access field or method of null object"
Function GetColor( red Var,green Var,blue Var )
--->red=gc.color_red


I'm using listboxes and buttons without a problem. What's up?


Booticus(Posted 2006) [#125]
Hey after using Koriolis' updated code, my tabbed items dont work any more. Im using a checker method to see if the tab is active:

     Select Lower(paletteWindowTabGroup.activeTab.text) 
     	Case "placement"
     		checkGUIPlacement
          Case "attributes"
          	checkGUIAttributes
     	Case "combat"
     		checkGUICombat
			If buttonPressed(paletteWindowTabGroup,"begin turn")
				combatTurn
			EndIf										
     EndSelect 


It will allow me to switch tabs around, but as soon as I click on a gadget within the tabbed portion, the window goes out of focus, and the gadgets don't respond. I rolled back to the previous version of Diablos code and recompiled the mod and it works fine again.

:( ???


Koriolis(Posted 2006) [#126]
Will check that, thanks to report.
To speed things up, could you post a minimal example demonstrating the bug?


Diablo(Posted 2006) [#127]
yea, and also siread.

I get no errors using koriolis code :?


Booticus(Posted 2006) [#128]
I get no errors per-se, just behaviour that I wasnt expecting, i.e. lost focus.

@Koriolis: Lemme see if I can put something together that replicates it. In the above code nugget I posted, that SELECT item is the tab's "active" state....Maybe I added the wrong code to the module and when I recompiled it something unforeseen happened? Is it possible for you to email me your updated code to mroberti@... ? That'd be cool!


Booticus(Posted 2006) [#129]
Never mind! I tried following instructions again, compiled your updated code and its working now! w00t! I'm not the sharpest tool in the shed, granted. ;)


Koriolis(Posted 2006) [#130]
Ahhhh. Glad not to have another debugging session to put on top of my pile of work.


Diablo(Posted 2006) [#131]
Ahhhh. Glad not to have another debugging session to put on top of my pile of work.

hehe.

That reminds me I have a lot of design work to be getting on width(not computer related).

@Booticus
:D


Booticus(Posted 2006) [#132]
OK, I've been lame before, but in hi_Textbox, I can type text in just fine, but the spacebar doesnt add a space? My words are all run together. Any hints or clues?


Diablo(Posted 2006) [#133]
Is this with the new input system? If its then I'll see whatscausing it.


Booticus(Posted 2006) [#134]
Hey Diablo, what new input system are you talking about? I basically redownloaded the module from your site and then added Koriolis' code from above. That's all I've done so far. Lemme know what you can suggest! No rush, as I'm not using anything that will require more than one word typed in the textbox for now.


Diablo(Posted 2006) [#135]
Hey Diablo, what new input system are you talking about?

Its up a few post (35).

I'll let you know if I find out what could be causing it.


Booticus(Posted 2006) [#136]
Yeah the new input code didn't fix it. Like I said, no rush!


Diablo(Posted 2006) [#137]
Ok,


Cruis.In(Posted 2007) [#138]
diablo any updates? Do you have a latest build model of the GUI including the fixes some have posted here? Such as the speed optimizing? I find now even tho my laptop is porgy that with only about 25 buttons, a tab box on screen and the usual old graphics my frames have gone to 16 from the cap of 60.

id like to get the enhancements here first, before going through my code to see if i did a little fubar. :)


Koriolis(Posted 2007) [#139]
That's a pretty godd question. Diablo...?
In the meantime, Cruis.In, you can easily include the speed optimization and rebuild the module yourself.


Cruis.In(Posted 2007) [#140]
ok ill do that. :)


K@li(Posted 2007) [#141]
it's the module abandonned ?

4 month and no any message...

have you an exemple with more gadget in use ?

i don't make work the function :

Function Create:hi_THScrollbar(x%, y%, w%, maxValue% = 100, parent:hi_TGadget = Null)


Diablo(Posted 2007) [#142]
it's the module abandonned ?

It was for a while(for which I have personal reasons) but I'll be working on it again soon.

Thanks for the intrest by the way.


Koriolis(Posted 2007) [#143]
Glad to hear that.


Diablo(Posted 2007) [#144]
Just done a site migration:
Visit it here <- needs updating as well D:

Also uploaded an updated with the speed improvment in, im not sure what else but I have checked to see if it broked some things and it didnt so it should work.


Otus(Posted 2007) [#145]
Hadn't seen this before. Will test.


Blueapples(Posted 2008) [#146]
Hey have there been any updates to this package?

I am using it in a new project I have started. It seems to be very complete but it seems that it has a few bugs, the most annoying one at the moment is that showing a hidden window does not bring it above other windows.


Cruis.In(Posted 2012) [#147]
diablo!