TotalCross Forums
September 07, 2010, 03:11:59 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: TotalCross - the heaven of mobile application development
 
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Panel must have its bounds set before calling Label [2]  (Read 303 times)
bradut
Full Member
***
Posts: 125



View Profile
« on: February 01, 2010, 10:39:52 pm »

Hi Again,

I am posting this message here since I had this issue on TotalCross first, and now I have it on SuperWaba, but the SuperWaba forum seems to have been closed / broken

So, on SuperWaba [and TC], I receive this error message:  "Panel must have its bounds set before calling Label"

What does this error message it means, and why it keeps on appearing?

This issue only appeared after I modified a conduit for Palm, and I wonder what I broke in the UI, because I can no longer display progress bars, labels, background...nothing, on the conduit panel Sad
« Last Edit: February 01, 2010, 11:00:13 pm by bradut » Logged
Fabio
Global Moderator
Full Member
*****
Posts: 182


View Profile Email
« Reply #1 on: February 02, 2010, 08:58:21 am »

Just checked, the SuperWaba forum seems fine: http://forum.superwaba.net/index.php

This error happens when you try to set the control bounds without first setting the bounds of the parent control.
Example:
Code:
public class BoundsError extends MainWindow
{
   public void initUI()
   {
      Container c = new Container();
      Label label = new Label("A Label");

      c.add(label, CENTER, CENTER); // ERROR
      add(c, LEFT, TOP, FILL, FILL);
   }
}
Logged
bradut
Full Member
***
Posts: 125



View Profile
« Reply #2 on: February 02, 2010, 07:24:04 pm »

Hello Fabio,

Thank you for reply.

- The SuperWaba forum looks OK , but when I want to register I receive:An Error Has Occurred!  Sorry, registration is currently disabled. 
[You may check this link:http://forum.superwaba.net/index.php?PHPSESSID=c5d1c35deef0b2ec1f91394821d03f3c&action=register]

- I have tried to addapt the code you was so kind to send me, but in my case, I need it to be a little different, since I have to test the SyncLib from a test class:
Code:
public class testClass extends MainWindow {
public testClass()
{
SyncPanel sp = new SyncPanel();
sp.isDebug = true; // sp.setDebug(true);
add(sp); // SuperWaba does not allow add(sp, LEFT, TOP, FILL, FILL);
sp.onStart(); //launch the SyncPanel
}

}

Here is the Container
Code:
public class SyncPanel extends Container {
.....

public void onStart() {

if (Parameters.doSync == true) {
int h = Settings.screenHeight * 1 / 6;
add(lblDebug = new Label("", CENTER), LEFT, h);
....

I got a warning right after add(lblDebug...
Warning! synclib.SyncPanelNew@17918f0 must have its bounds set before calling waba.ui.Label@1546dbc.setRect
Logged
nobre
Full Member
***
Posts: 224


View Profile
« Reply #3 on: February 03, 2010, 09:27:47 am »

Hi bradut,
The method add(control, POSITION, POSITION) is nothing more than a "add(control); control.setRect(POSITION,POSITION);"
When you set a control's rect, the onStart() method is called automatically as well, so you don't need to call it.
At last, if you really must call the onStart(), you should call this.setRect() before adding anything to it.
« Last Edit: February 08, 2010, 09:42:34 am by nobre » Logged
bradut
Full Member
***
Posts: 125



View Profile
« Reply #4 on: February 05, 2010, 07:58:23 pm »

Thank you,

Using this.setRect(....) worked for me!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!