LogoLogo
v7.0.0
v7.0.0
  • TotalCross Overview
  • TotalCross Javadoc
  • TotalCross Changelog
  • Roadmap
  • Documentation
    • Getting Started
      • First embedded project with TotalCross
    • Components
      • Accordion
      • Aligned Labels
      • Button
      • Check
      • ComboBox
      • Dynamic Scroll
      • Edit
      • Floating Button
      • Gpiod
      • Grid
      • GridContainer
      • Image
      • ImageControl
      • ImageList
      • Label
      • Material Icons
      • Material Window
      • MessageBox
      • Multi Edit
      • Progress Bar
      • Progress Box
      • Radio
      • Radio Group
      • Scroll Container
      • Side Menu
      • Slider
      • Sliding Window
      • Spin List
      • Spinner
      • Switch
      • Tabbed Container
      • Velocimeter
    • APIs
      • API Overview
      • API Rest
      • Asynchronous Task
      • Camera
      • Control
        • Main Window
        • Window
        • Container
      • GPS
      • HTTPS and SSL
      • JSON
      • Maps
        • Maps - Deprecated
        • Static Map
      • Material Design Standards
      • Ninepath
      • Notifications
      • PrinterManager
      • Push Notification Firebase
      • Scanner
      • SOAP
      • Socket
      • SocketServer
      • SQLite Encryption
      • QR Code Generator
      • totalcross.sys
      • Youtube API
    • Creating an Issue
    • Contributing
      • Branch workflow
      • Writing documentation
    • Guides
      • App Architecture
        • Suggested Architecture
        • Why do Design Patterns help with the application's organization?
          • MVC Architecture Pattern
          • Template Pattern
          • Data Persistence: DAO Pattern.
        • Separation of concepts: What is the best way to create UI interfaces?
        • Positioning
          • Manual Positioning
        • Relative Positioning
        • Best practices to improve project maintenance
      • Device Simulator
      • Package your app from scratch
        • TotalCross SDK
        • Environment Variables in IDE
          • Eclipse
          • IntelliJ
        • Deploy your app with a dependecy TC
        • Deploy iOS
          • Using Development certificate to test your apps
      • Understanding TotalCross for Linux ARM
      • Running C++ applications with TotalCross
      • Web Services
    • Miscelaneous
      • Java JDK 8
      • Maven
      • Installing Visual Studio Code
    • FAQ
      • IMEI in Android 10
Powered by GitBook
On this page
  • Overview
  • Source Code
  • Methods

Was this helpful?

  1. Documentation
  2. Components

Sliding Window

PreviousSliderNextSpin List

Last updated 4 years ago

Was this helpful?

Overview

Sliding Window is a fullscreen window that slides in and out of the screen during pop and unpop events. Use it to create transition effects between screens.

Source Code

package com.totalcross;

import totalcross.ui.Container;
import totalcross.ui.Presenter;
import totalcross.ui.SlidingWindow;

public class MySlidingWindow extends SlidingWindow {

    public MySlidingWindow(boolean delayInitUI, Presenter<Container> provider) {
        super(delayInitUI, provider);
    }

    public MySlidingWindow(Presenter<Container> provider, int animDir,
                                                          int totalTime){
        super(provider);
        this.animDir = animDir; // This can be LEFT or RIGHT, any other will
                                // be BOTTOM
        this.totalTime = totalTime; // Time, in milliseconds for the animation
    }
}
MySlidingWindow slidingWindow = new MySlidingWindow(new Presenter<Container>(){
            
		 @Override
		 public Container getView() {
				return new Container() {
          public void initUI() {
            ImageControl i;
            try {
                i = new ImageControl(new Image("images/logoV.png"));
                i.scaleToFit = true;
                i.centerImage = true;
                add(i, CENTER, CENTER, 100 + DP, 100 + DP);
            } catch (IOException e) {
                e.printStackTrace();
            } catch (ImageException e) {
                e.printStackTrace();
            }
          };
        };
	   }
}, RIGHT, 500);
slidingWindow.popup();

Methods

Type

Name

Description

Constructor

SlidingWindow(Presenter<Container> provider)

Creates a SlidingWindow with the specified provider. Use the provider class to implement your view code.

Constructor

SlidingWindow(Presenter<Container> provider, boolean delayInitUI)

Creates a SlidingWindow with the specified provider and if it should delay the InitUI execution. Use the delayed InitUI if your screen takes a significant amount of time to load (e.g., it fetches data from a server) and the non-delayed InitUI if it is fast enough to be loaded prior to the animation. If the delayed option is used, the screen will popup with a spinner.

void

unpop( )

Unpops the SlidingWindow, hiding it.

void

popup( )

Popups the SlidingWindow, showing it.

Because it is a more complex example, we only show the specific Sliding Window example code, if you want to see the whole code of the image interface construction .

click here