FAQ

Como desenvolver para RPI usando TotalCross?

Basta adicionar na pom.xml, no lugar da versão do SDK do totalcross, o seguinte comando:

<scope>system</scope>
<systemPath>caminho\TotalCross\dist\tc.jar</systemPath>

feito isso, você já consegue fazer deploy. Já para desenvolver, é a mesma forma que se desenvolve para mobile.

We have a proxy and it is blocking the compilation of our app what do you suggest?

Just add iso to pom.xml:

<dependency>
<groupId>com.totalcross</groupId>
<artifactId>totalcross-sdk</artifactId>
<version>5.1.1</version>
<scope>system</scope>
<systemPath> PATH__TO__YOUR__TOTALCROSS__JAR__FILE </systemPath>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.7</version>
<scope>compile</scope>
</dependency>

Attention: Please be aware if the version indicated on the pom is the same as your machine.

How to disable backup / restore in TotalCross?

To disable backup just add Settings.allowBackup = true within the constructor method in your application's MainWindow

Every time there is a touch on the screen, the event is triggered. How to fix?

This may be happening because you are using the pendown instead of the penup. To better understand, follow the definitions:

  • pendown is triggered when there is a touch on the screen.

  • penup is triggered when finger flips the screen (or mouse/key, depending on the platform).

To find out if there was a click, it can be detected through the pendrag, and if it is positive, do not trigger the penup.

Another smarter solution is to use the this.hadParentScrolled() method within your pendown method, to identify whether the action is being triggered during the scrolling of some parent component. As shown below:

if (!this.hadParentScrolled()) {
// código de pen down
}

How to navigate between screens (Containers and Windows)?

In the case of Containers:

  • swap(new InitialScreen()); - If you are in the Main Window and want to call a Container, simply use the swap() command.

  • MainWindow.getMainWindow().Swap(new SecondScreen()); - If you are in a container or Window and want to call a Container just use the command.

In the case of Windows:

  • .popup() - The execution stops after the popup()command is executed.

  • .popupNonBlocking() - the execution continues right after the popup command, even with the window still open

To understand more in depth how best to use and other ways to navigate between user interfaces, click here

Is it possible for the buttons to be round?

Yes, if it is an FAB we have a component of its own, the FloatingButton. In other cases, you can change using NinePatch or do the most recommended: use an ImageButton as in the following example:

Image original = Images.getTotalCrossLogo();
// If you need to resize it, this is the method call.
Image aumentada;
try {
aumentada = original.hwScaledBy(0.5, 0.5);
Button btn = new Button(aumentada);
// If you want to change the image when the button is clicked, use this property
// The "getTouchedUpInstance" method is a good place-holder. btn.pressedImage = aumentada.getTouchedUpInstance((byte) 64, (byte) 0);
// Finally, take a default button border and ninepatch
btn.setBorder(Button.BORDER_NONE);
btn.setNinePatch(null);
add(btn, CENTER, CENTER);
} catch (ImageException e) {
e.printStackTrace();
}

Slowdown when opening in Windows with a Roboto font

Just use Font.getFont ("Roboto Medium", true, FontSize);

Is there a maximum file size to be retrieved by the Vm.getFile (String) method?7

I checked it here, Vm.getFile looks for the file in the TCZs. An embedded file in TCZ has its size given in an int32 uncompressedSize; therefore, it can not be more than 4gb. As TotalCross apps are 32bits, as far as I can remember, I would still lower this limit to 2gb, because the system will not be able to allocate more than this contiguous memory.

What is the difference between Window and Container?

First, the main function of each is different:

  • Container: A control capable of containing other controls. It is primarily a form of organization.

  • Window: it is a control capable of overlapping others, creating an illusion of depth. In addition, Windows is also containers, as they can accommodate several components within them.

To better understand the difference between them in specific cases and how to use both in the most appropriate way, access the Windows X Container session.

Is it possible to search for GPS position through Triangulation?

By default the GPS class performs location only via GPS, but on Android, you can change your behavior to use Google Play Services to get the location. To do this, change the field precision value to to LOW_GPS_PRECISION.

Location by Google Play Services is based on a variety of information, including Wifi and Bluetooth. If you specifically want information about the network location used, you can use the CellInfo class in WinCE or Android.

How to use the DecimalFormat on TotalCross?

Totalcross doesn't have the java.text so the DecimalFormat is not on our SDK.

How to ativate the OK (ENTER) button on Android

Just use the .addKeyListener and add an action in the specialkeyPressed method like no example below:

Edit edtExit = new Edit();
edtExit.addKeyListener(new KeyListener() {
...
@Override
public void specialkeyPressed(KeyEvent keyEvent) {
if(keyEvent.isActionKey()){
proximaTela();
}
}
});
add(edtExit, CENTER, AFTER + 40, PARENTSIZE, PREFERRED);