Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Not Stupidity this time...

Options
  • 09-05-2006 12:39pm
    #1
    Closed Accounts Posts: 521 ✭✭✭


    I have a fully working chat program at this point with one major problem....
    * The call back is sent tothe console
    I need it to be sent to a textArea and cant find any help with the matter.

    Per chance could the Genius in these forums be able to help me out?

    The IDL looks like this...
    module Step1{
    	
    	interface ClientOps  {
    	        [b]void callBack(in string message);[/b]
        	};
    	
    	struct person{
    		string name;
    		string address;
    		string email;
    		string userName;
    		string password;
    	};	
    	
    	interface signUp {
    		string store(in person myPerson);
    		boolean getPerson(in string userName, in string pass);
    		string loadFullTree();
    		void newTopic(in string topic, in string subTopic);
    		void newSubTopic(in string Topic, in string subTopic);
    		long registerCB(in ClientOps c, in string topic, in boolean open, in long id);
    		[b]void chat(in string message, in string name, in string topic);[/b]		
    	};	
    	
    };
    

    and the callBack method in the servant...
    public void chat(String message, String name, String topic){
    		int k = 0;
    		nameTable = (Hashtable)allTable.get(topic);
    
    		do{
    			client = (ClientOps)nameTable.get(String.valueOf(k));
    			[b]client.callBack(name+" Says: "+message);[/b]
    			k++;
    		}while(nameTable.get(String.valueOf(k)) != null);
    	}
    

    If any more code is required let me know.
    Any Ideas are VERY welcome, please!


Comments

  • Closed Accounts Posts: 80 ✭✭Torak


    Could be way off the mark, but you could try something like this..

    I'm assuming that you are using java 2 or higher... if not then adjust as appropriate..
    public void chat(String message, String name, String topic){
    		nameTable = (Hashtable)allTable.get(topic);
    
                    for (Iterator it = nameTable.values().iterator(); it.hasNext();) {
    			client = (ClientOps)it.next();
    			client.callBack(name+" Says: "+message);
                    }
    
    	}
    

    oh and if that doesn't work you will have to post more code (IDL Not Important) in order to figure out what the class is doing...


  • Closed Accounts Posts: 521 ✭✭✭EOA_Mushy


    I think i need to explain this a lot better.

    The chat method was not working perfectly and thank you for that. However the main problem is that when callback is used it prints to the console. This is achieved by:
    class ClientOpsImpl implements ClientOpsOperations{
    	public void callBack(String message) {
    		System.out.println(message) ;
    
    	}
    }
    

    What I want it to do is put the messege from the callback into a textArea within the class that called the chat method. (in the original post)

    I am in my final year of college, so im not new to java, but not that experienced either. Any pointers?


  • Closed Accounts Posts: 80 ✭✭Torak


    EOA_Mushy wrote:
    I think i need to explain this a lot better.

    The chat method was not working perfectly and thank you for that. However the main problem is that when callback is used it prints to the console. This is achieved by:
    class ClientOpsImpl implements ClientOpsOperations{
    	public void callBack(String message) {
    		System.out.println(message) ;
    
    	}
    }
    

    What I want it to do is put the messege from the callback into a textArea within the class that called the chat method. (in the original post)

    I am in my final year of college, so im not new to java, but not that experienced either. Any pointers?

    You need to show the code of the class that has the textarea but I imagine the class (with all embellishments removed) looks something like this..
    
    public class MyGUIAppScreen extends ABaseComponentOfSomeNature {
    
      private TEXTAREACOMPONENT textArea = new TEXTAREACOMPONENT();
    
      public void doCallServer() {
         // do CORBA and SERVER STUFF IN HERE when somebody chats..
      }
    
      public void appendMessage(String message) {
         String text = textArea.getText();
         text = text + "\n" + message;
         textArea.setText(text);
      }
    
    class ClientOpsImpl implements ClientOpsOperations{
    	public void callBack(String message) {
    		[B]appendMessage(message)[/B];
    
    	}
    
    
    }
    
    }
    


  • Closed Accounts Posts: 521 ✭✭✭EOA_Mushy


    Torak wrote:
    You need to show the code of the class that has the textarea but I imagine the class (with all embellishments removed) looks something like this..
    
    public class MyGUIAppScreen extends ABaseComponentOfSomeNature {
    
      private TEXTAREACOMPONENT textArea = new TEXTAREACOMPONENT();
    
      public void doCallServer() {
         // do CORBA and SERVER STUFF IN HERE when somebody chats..
      }
    
      public void appendMessage(String message) {
         String text = textArea.getText();
         text = text + "\n" + message;
         textArea.setText(text);
      }
    
    class ClientOpsImpl implements ClientOpsOperations{
    	public void callBack(String message) {
    		[B]appendMessage(message)[/B];
    
    	}
    
    
    }
    
    }
    

    I LOVE YOU!!!! :D


  • Closed Accounts Posts: 80 ✭✭Torak


    EOA_Mushy wrote:
    I LOVE YOU!!!! :D

    I assume that means you got it working... :)


  • Advertisement
  • Closed Accounts Posts: 521 ✭✭✭EOA_Mushy


    yes :)


Advertisement