ProGUI V1.38 UI Library (Small Bug Fix)

Developed or developing a new product in PureBasic? Tell the world about it.
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by Zach »

Also on a second note.. I am having trouble with TextControlEx

I can use the Font command to set a font, but I can't use the Color setting command. It just don't want to work, even though your example code works as far as I can tell..

Is there some tricky stuff involved I need to do, because I'm using it in a PanelEx Page? I dunno, it has to be a bug somewhere in my code because before I trashed my GUI and started over I had a TextControlEx with a Gradient + White text that worked fine; but now I can't get it to change the color or anything..

This is the procedure I'm working on at the moment

Code: Select all

;// Room Manager Page
;// Displays a Master List of all Rooms in the Database, allowing you to
;// Add, Remove and Edit Rooms.
Procedure Room_Manager()
  AddPanelExPage(0)         ;// AddPanelExPage must be present in Function
                            ;// in order for GUI elements to show up on the
                            ;// correct Panel Page.
  
  ;SetTextControlExColour(-1, MakeRGB(0,0,0), MakeRGB(0,0,0))
  SetTextControlExFont(-1, Header_Font, 0)
  SetTextControlExColour(-1, 0, MakeRGB(180,180,255))
  map_Room_Manager("Header")  = TextControlEx(PanelExID(PanelMaster, 1), #ProGUI_Any, 0, 0, 175, 50, "Room Manager", #TCX_CENTRE | #TCX_VCENTRE)

  
EndProcedure
The TextControlEx shows up fine (that was a PITA I had to look in your example again to find out I needed to use the PanelExID() command for the ID), and I can change the font, but the color settings don't apply at all..

I think I also had problems with Purebasic and SetGadgetColor with a TextGadget (which should work) before I switched to trying the PanelEx.. I don't know, maybe its something I am doing elsewhere in the program, but I haven't a clue of where to check :oops:

EDIT: Ok for whatever reason I got it to work using my predefined variable names.. I think there is a bug though, I will make another post
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by PrincieD »

Hey Zach,
Zach wrote:This isn't really a -huge- issue but more of a minor annoyance. I was wondering if you could adopt more standard spelling conventions for your commands. I am aware you're from the UK and that words are generally spelled differently over there but sometimes it can be a confusing pain..i.e Colour reads OK for me, but Centre vs Center just drives my eyeballs insane.
Yep sure I've been meaning to do this for a while, just one of those little things that keeps slipping my mind lol Search & Replace (destroy! ;)) is the order of the day /me thinks, I'll correct it in the new update :)
Zach wrote:Personally this is where PB falls down with the lack of namespace support IMHO, because then we could have simple stuff like...
That would be a really nice feature actually :) although I don't think there are any conflicting commands in ProGUI with the spellings changed to International English (I've been pretty careful with the naming).
Zach wrote:I can use the Font command to set a font, but I can't use the Color setting command. It just don't want to work, even though your example code works as far as I can tell..

Code: Select all

Success = SetTextControlExColour(ID.i, TextColour.l, BackColour.l)
Looks like you're altering just the back fill colour ;) (which won't show up anyway unless the #TCX_BK_FILL flag is used).

I should have a new release ready in a couple of days, I'm re-coding the gradient sub-system to use hardware acceleration (which has been a major bottle-neck in speed) and let me tell you it's fast as fuuuuke! :D also I've wrote a pretty damn cool new PanelEx example that shows off some advanced features but you'll have to wait and see :P

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by Zach »

I think there is a bug with your MakeColour() command.

I don't understand how Alpha channel is supposed to work.. But let me address something else first.

Code: Select all

;// Documentation lists the command as
;// MakeColour(Alpha, Red, Green, Blue)

;// This command presents Blue Text
MakeColour(0, 255, 0, 0)

;// This command presents Green Text
MakeColour(0,0,255,0)

;// This command presents Red Text
MakeColour(0,0,0,255)
So I think the command has some parameters reversed.
Secondly I notice weird behavior with different Alpha values... I am not familiar with Alpha channels and how they are supposed to work, other than adjusting properties in other programs. Its supposed to adjust the level of transparency of a color and such... ? Logically if Alpha runs 0 - 255, should 0 not equal full transparency, 255 equal no transparency, and values inbetween should show different levels of opacity?

I don't see any opacity changes when I modify the Alpha channel of my colors, but I DO see an apparently swap of some kind, between the color I am attempting to display, and a default black color..

Remember, the parameters on the function seemed to be out of order, so ignore those.. just focus on the changes to the (supposedly) Alpha channel.

Code: Select all

MakeColour(0, 0, 0, 0)  ;//  This shows a solid black color
MakeColour(100, 0, 0, 0) ;// Solid Black
MakeColour(249, 0, 0, 0) ;// Solid Black

MakeColour(0, 255, 0, 0)  ;// Solid Blue Color
MakeColour(50, 255, 0, 0)  ;// Solid Black
MakeColour(100, 255, 0, 0) ;// Solid Blue
MakeColour (101, 255, 0, 0) ;// Solid Black
MakeColour (249, 255, 0, 0) ;// Solid Black
MakeColour (250, 255, 0, 0) ;// Solid Black
MakeColour (200, 255, 0, 0) ;// Solid Blue
MakeColour (201, 255, 0, 0) ;// Solid Black

;// PureBasic's  RGBA() command is more straightforward
;// The Alpha channel is the last channel,  and also the color
;// rotates between Black and the desired Color predictably
;// i.e  A = 0  is Blue, A = 1 is Black, A = 2 is Blue, and so on
;// all the way up to 255.
So basically I feel like I am getting inconsistent results from the Alpha channel that display no discernable predictability of what I can expect from changing a value??
I don't know why Alpha channel behaves this way with Text, but that is probably more of a Purebasic question than a ProGUI question, my main concern is the out of order parameters and the unpredictable results of changing the Alpha channel.
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by Zach »

PrincieD wrote:Hey Zach,

Zach wrote:I can use the Font command to set a font, but I can't use the Color setting command. It just don't want to work, even though your example code works as far as I can tell..

Code: Select all

Success = SetTextControlExColour(ID.i, TextColour.l, BackColour.l)
Looks like you're altering just the back fill colour ;) (which won't show up anyway unless the #TCX_BK_FILL flag is used).

I should have a new release ready in a couple of days, I'm re-coding the gradient sub-system to use hardware acceleration (which has been a major bottle-neck in speed) and let me tell you it's fast as fuuuuke! :D also I've wrote a pretty damn cool new PanelEx example that shows off some advanced features but you'll have to wait and see :P

Chris.
Apologies, that copy/paste was right out of your example file. But I was certain I was using the correct parameter order in my attempts..

Perhaps that was my mistake as I was getting frustrated... it seems to be working properly now :? I tried both a Variable name and a MakeRGB() on the spot and they do seem to work..
ALthough I think I did uncover some other bugs with the color commands, see post above


To answer your inquiry about Naming clashes with PB / ProGUI I have the following commands available in my PB install

MakeColor()
MakeColour()

In this one instance it seems they both come from ProGUI?? That confused me and I thought MakeColor() was a native PB command I guess... When I hit F1 on MakeColor() the help file gives me an error however, whereas MakeColour() takes me to the Help page for MakeColour(). The MakeColor() does work as I just tried it, but it also suffers from the same out of order parameter issue outlined in my post above this one.
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by PrincieD »

Hey Zach,

Yep the MakeColor and MakeColour commands are identical just different versions to account for American spelling preference, however I'll just alter all the spellings to American English. The MakeColour is meant to be used with certain WinAPI commands (an equivalent macro is used) where the bit order needs to be in reverse, hence Alpha value as first parameter. It's the standard convention by the way of Alpha = 255 to be fully opaque and 0 = fully transparent. Any colours in ProGUI are defined using the standard PureBasic RGB command unless otherwise stated in the docs (when an alpha channel is supported, gradients for example).

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by Zach »

I don't really take issue with the actual order of the parameters (i.e Alpha being first)

What I was trying to point out, was that the order of the color channels as implemented in code, contradicts what is written in the documentation.

The command is actually ordered A, B, G, R instead of the documented A, R, G, B

Your MakeRGB() command, on the other hand works flawlessly as documented, with R,G,B in the correct order.
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by PrincieD »

Zach wrote:I don't really take issue with the actual order of the parameters (i.e Alpha being first)

What I was trying to point out, was that the order of the color channels as implemented in code, contradicts what is written in the documentation.

The command is actually ordered A, B, G, R instead of the documented A, R, G, B
Like I said, the bit order is reversed as certain WinAPI commands need the colour format to be in this way. If you're trying to use the command on something that expects standard RGB then the colours will look incorrect.

From the docs:
Returns a Windows compatible RGB colour with alpha channel, useful for some Windows API calls.
Edit

Actually I've re-read the description in the docs and it's probably a bit confusing, sorry. Where it says "Returns a Windows compatible RGB colour" I'll change it to "Returns a Windows compatible ABGR colour"

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by Zach »

Ok we're making progress... you've got it 99.9%

Now for the other 0.1%

You also should change the listed syntax FROM
MakeColour(Alpha.l, Red.l, Green.l, Blue.l)
TO
MakeColour(Alpha.l, Blue.l, Green.l, Red.l)
That is what confused me more than the description of the command.... I was actually so frustrated I assembled a screenshot collage to make you understand :|

Currently, if I use the command as documented in the Help file, expecting to get a Red color, I will get a Blue one.

that's all I was ever trying to say :x
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by Zach »

And now something we can all laugh at. Take pitty on my Windows Paint skillz.

Image


The description, albeit lacking, was never the problem. Do you understand now?
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by PrincieD »

Apologies Zach, in hindsight I should have arranged the parameters in their actual bit order but I thought it would save accidental mistakes by keeping the RGB parameters in the expected sequence. The trouble is now if I alter the parameter order, a lot of code could break and wouldn't be immediately obvious to the user of what's causing the issue. I would also need to manually swap a lot of colours around inside ProGUI. I think the updated description in the docs should suffice as the command won't be really needed once I get the new gradient code working fully - it will use the RGBA format.

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by PrincieD »

Zach wrote:And now something we can all laugh at. Take pitty on my Windows Paint skillz.
The description, albeit lacking, was never the problem. Do you understand now?
hehe yep, The TextControlEx doesn't support alpha channel in the text colour so just use the standard RGB to make the colour. If you need to make the TextControlEx alpha transparent then use the SetPanelExPageAlpha command on it's handle.

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by Zach »

Changing the parameter order is pointless, like I acknowledged.

Just need to update the incorrect Syntax and Description in the Documentation and it won't break anything and nobody should be confused by it anymore.
New Gradient code sounds interesting though.

I think you have entirely too many different color commands :mrgreen: Hopefully further updates will allow you to consolidate and prune out duplicate function sets.
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by PrincieD »

Zach wrote:Changing the parameter order is pointless, like I acknowledged.

Just need to update the incorrect Syntax and Description in the Documentation and it won't break anything and nobody should be confused by it anymore.
New Gradient code sounds interesting though.

I think you have entirely too many different color commands :mrgreen: Hopefully further updates will allow you to consolidate and prune out duplicate function sets.
Yup, the MakeColour command is only really used with the gradients because they support an alpha channel - I basically wrapped up a Windows macro that was needed for the colour format (should have converted to RGBA in hindsight but alas, these were the days before PB had RGBA :wink:). The new gradient code is already whooping ass! though :) everything in ProGUI (already speed demon! :twisted: ) should be considerably quicker as gradients are used quite heavily throughout.

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by Zach »

Just a tip for everyone who may be reading this. I actually came to post this problem but then as I was typing it out the solution came to me and I realized what I had done.. (funny how that works)

If you organize your project into include files, i.e to keep separate design elements, or sub-systems of your program organized;

Make sure that before all your file includes, you Initialize ProGUI with your key

I made the mistake of keeping this at the top of my Windows GUI/Event loop. It isn't necessarily a bad thing after all, but when I decided to move my code for loading Fonts and defining custom Colors out of my GUI header (which is included after the GUI/Event Loop file) and into a common data file, since I could re-use these variables, it was causing an unclear error that ended the program with no log info. The program would compile and start, pause briefly and then error-out (never showing a Window).

In retrospect the reason was obvious, but our Initialization Key is a single line of code that is probably overlooked more often than not, as you only call it once in a project and then forget about it.
So my program was trying to use data that didn't properly exist, because ProGUI wasn't even initialized yet! :shock:

Hopefully I will be the only one to ever make this mistake :mrgreen:

As a side note, I am kind of surprised PGUI commands don't check to make sure the Library has actually been loaded before being executed, and throw a subsequent error as a result.
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.36 User Interface Library (Small bug fix)

Post by PrincieD »

Good tip Zach, it's an easy mistake to make :)
As a side note, I am kind of surprised PGUI commands don't check to make sure the Library has actually been loaded before being executed, and throw a subsequent error as a result.
That's a good idea, I'll make so ProGUI throws an error message box if a command is called before StartProGUI.

Here's the new PanelEx example I'm working on (still work in progress):

Image
http://www.progui.co.uk/downloads/PanelExample2.zip

The example really shows how powerful the control is and what's possible with the usercallback parameter and a little imagination ;) oh the stars are a real-time animated starfield btw 8)

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Locked