PDA

Click to See Complete Forum and Search --> : Why wont Form2 f = new Form2(); not work?


invitro
Aug 23rd, 2000, 08:52 PM
Ok i created a f object.
Form2 f = new Form2();
but when i do, f.settext("12345");
it wont set it. And also, i have a procedure in form2 called givemoney.

If i do
f.givemoney(val 1, val2);
it wont set the money count the way it should.

any ideas?

parksie
Aug 24th, 2000, 01:01 PM
It's probably something internal to Form2. Could you post some of your code, please?

invitro
Aug 24th, 2000, 10:04 PM
import com.ms.wfc.app.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
import com.ms.wfc.html.*;
/**
* This class can take a variable number of parameters on the command
* line. Program execution begins with the main() method. The class
* constructor is not invoked unless an object of type 'Form3'
* created in the main() method.
*/
public class Form3 extends Form
{
private int c_count;
public Form3()
{
super();

// Required for Visual J++ Form Designer support
initForm();
c_count = 0;
// TODO: Add any constructor code after initForm call
}

/**
* Form3 overrides dispose so it can clean up the
* component list.
*/
public void dispose()
{
super.dispose();
components.dispose();
}



private void cheat_keyPress(Object source, KeyPressEvent e)
{
String c_get;
long c_put;
int lines;
Form1 master_cheat = new Form1();

c_get = "";


if(e.keyChar == 13) {


String c_run [] = cheat.getLines();
c_get = c_run[c_count];
c_count += 1;

if(c_get.substring(0,6).compareTo("money=")== 0) {
// c_put = c_get.substring(5,c_get.length ());
c_get = c_get.substring(6,c_get.length());
c_put = Long.valueOf(c_get).longValue();



master_cheat.addmoney(c_put,true);





}

}

}

private void cheat_textChanged(Object source, Event e)
{

}



private void cheat_enter(Object source, Event e)
{


}

/**
* NOTE: The following code is required by the Visual J++ form
* designer. It can be modified using the form editor. Do not
* modify it using the code editor.
*/
Container components = new Container();
Edit cheat = new Edit();

private void initForm()
{
this.setText("Cheat Form");
this.setAutoScaleBaseSize(new Point(5, 13));
this.setBorderStyle(FormBorderStyle.FIXED_SINGLE);
this.setClientSize(new Point(273, 153));
this.setMaximizeBox(false);

cheat.setSize(new Point(272, 152));
cheat.setTabIndex(0);
cheat.setText("");
cheat.setMultiline(true);
cheat.setScrollBars(ScrollBars.BOTH);
cheat.addOnEnter(new EventHandler(this.cheat_enter));
cheat.addOnKeyPress(new KeyPressEventHandler(this.cheat_keyPress));
cheat.addOnTextChanged(new EventHandler(this.cheat_textChanged));

this.setNewControls(new Control[] {
cheat});
}

/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main(String args[])
{
Application.run(new Form3());
}
}


This is my entire Form3
Theres the addmoney function in Form1 im traying to call out, but it wont even work. Same if i do master_cheat.setText("12345");
it wont set.


[Edited by invitro on 08-24-2000 at 11:10 PM]