Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

G4P opening new Window Problem

$
0
0

This is a old window problem we talked about with Peter Lager and his G4P GUI library. When opening anew window with its default state, the windows opens quite normally but if there is any modification on the elements of this window just after the opening, there may have some crashes. Unfortunately, this may happen after several openings or just at first...

I've made a little program that opens and close a window automatically every 5s...

I can send it to anyone that wants to try on Linux, Mac OS or Windows.

Right now I made the tests on Windows only.

It seems that we can't send files on this forum. I'm trying to copy the code instead.

Here is the first page, it's quite simple, a standard setup.

// Need G4P library
import g4p_controls.*;

String Lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit,§ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.§ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.§ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.§ Excepteur sint occaecat cupidatat non proident,§ sunt in culpa qui officia deserunt mollit anim id est laborum.";
String TxtCodeBloc = "Bonjour,§enfant de la nature,§ toi qui veille sur notre avenir infiNi"+"\nPoPol"+"Ne comptons plus sur les périodes dites creuses pour§ assécher le guano sur les rochers humides du Nouvel Empire."; //
String CodeBloc = "";
boolean Sq = false;
boolean Ouverture = false;
int NbOPen=0;


public void setup(){
  size(300, 200, JAVA2D);
  surface.setLocation(500, 100);
  createGUI();
}//Fin setup

public void draw(){
  background(230);
  textSize(15);
  fill(50);
  text("Ouvertures: "+NbOPen,10,150);

  if (Sq == true){
    int m2 = millis();
    int Tps;
    Tps = (m2 % 10000)/1000;
    text(Tps,10,100);
    if (Tps < 5){
      text("lancement",10,75);
      textarea2.setText("");
    } else {
      text("fermeture",10,75);
    }
    if (Tps == 5 && Ouverture == false){
      button2_click1(button2, GEvent.CLICKED);
      Ouverture = true;
    }
    if (Tps == 9 && Ouverture == true){
      if(G4P.getOpenWindowsAsList(null).contains(window1)) {
        window1.close();
        Ouverture = false;
      }
    }
   //if (Ouverture == true){ChTx();}//Change the text
  }//Fin Sq true
}//Fin void draw


public void ChTx(){//Changement du texte

  CodeBloc = Lorem.replace("§", "\n");
  textarea2.setText(CodeBloc);
  CodeBloc = "";

  window1.noLoop();
  textarea1.setText("");//On efface le textarea
  CodeBloc = TxtCodeBloc.replace("§", "\n");
  textarea1.setText(CodeBloc);
  CodeBloc = "";
  window1.loop();
}///Fin ChTx

Viewing all articles
Browse latest Browse all 2896

Trending Articles