G4P GUI Builder Error/Crash

While working in the G4P GUI Builder I inadvertently must have dragged one of the labels such that it's width became <0. At least that's what seems to be causing the an error An error occurred inside "G4P GUI Builder" with the following error dump (First few lines only shown):

_===================================================

G4P GUI Builder 4.2.1 created by Peter Lager

java.lang.IllegalArgumentException: Width (-24) and height (10) cannot be <= 0 at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016) at java.awt.image.BufferedImage.(BufferedImage.java:333) at g4p_controls.StyledString.getParagraghSpacer(Unknown Source)_

So, I can't get back into the GUI Builder to fix it and of course it's not permitted to edit the bad value in the gui tab :(

label5 = new GLabel(this, 220, 200, -20, 20);

Is there any way I can work around this or have I just lost an evening's work on my UI?

I'd really appreciate any help ^:)^

Phil.

Tagged:

Answers

  • label5 = new GLabel(this, 220, 200, -20, 20);

    How were you able to access this line of code? Not much experience with G4P. However, if your file is a pde, then you could open it with your favorite text editor(vim, notepad++) and change those values. Then, if you run it in G4P builder, it should work (?) I am also tagging @quark as he can tell you better what you could do.... hopefully he has a great suggestion.

    Kf

  • Thanks Kf,

    That line of code is part of the code that is autogenerated by GUI Builder to create all the controls. Although you **can **edit it this won't work because the error is still in the GUI Builder data file that is created when you use GUI Builder to design your UI.

    Phil

  • You can change the width/height of the label in GUI Builder. Select the label from the tree view (top right pane) and then change the width and height values in the properties grid (bottom left pane. This can be used to correct negative values.

  • edited June 28

    Hi quark,

    Unfortunately I can't get into GUI Builder to fix the values. When I try to open it I get the error I quoted in my OP: An error occurred inside "G4P GUI Builder" with the error dump that I quoted the first few lines of.

    If I try to run the sketch I get a blank window and the error Width (-20) and Height (20) cannot be <=0 and the line of code referring to label5 that I quoted is highlighted.

    **However **I've just managed to get it to run by changing the bad value in the gui tab back to the correct value of +20 again. The problem is that the G4P GUI Builder option on the Tools menu is now greyed out.

    Thanks for your help once again.

    Phil

  • Answer ✓

    My solution works for negative heights but not negative widths.

    Unfortunately if this happens then GUI Builder cannot open the file where the GUI is stored, so there is no solution. If this happens your only resource is to edit the gui tab code.

  • Thanks quark. Now I have the excuse to get into G4P properly and write my own code. I almost had the UI finished so just need to create the rest of the controls in the gui tab.

    Phil.

Sign In or Register to comment.