CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Dialog

  1. #1
    Join Date
    Jul 1999
    Posts
    47

    Dialog

    Hello Friends

    I'm writing a wrapper class MyWrapper for dialog.I have TextFiled , OK Button and Cancel Button on MyDialog. the wrapper class returns Textfield value by function getTextfieldValue().and wrapper class also has a function showDialog() function.

    I'm Using this wrapper class in another Pprogram i.e Myanother() extends Frame. This has a button1 on this. If I press button1:
    1)I'm Creating a Wrapper class.
    MyWrapper wrap = new MyWraper();
    2) then, I'm calling s
    wrap.showDialog();
    now i'll get MYDialog on the screen.
    3) here i entered "APPLE" in text field.
    4) To get Text field value ,
    I can use Wrapper class function
    String str = wrap.getTextFieldValue();
    But I want to get this value , if user presses OK button on My Dialog.
    But, How Myanother Program (i.e External Program ) Knows User pressed OK Button. If User Presses OK Button on My Dialog, Then Only I have to use the Function getTextFieldValue().

    Q1)But How External program knows that User pressed OK Button.

    Q2)If i write a bean to this wrapper, how to raise event and inform to external program that, user has pressed OK Button??

    Please clarify my doubt...

    Regards
    sat





  2. #2
    Join Date
    Sep 1999
    Location
    Madurai , TamilNadu , INDIA
    Posts
    1,024

    Re: Dialog


    Have one member variable and two constants in your Wrapper Class..

    // Variable

    public int nID = 0;

    // Constants

    public final static ID_OK = 1;
    public final static ID_CANCEL = 2;

    and in your button click action listener , set the appropriate values to
    nID.

    if ( "OK button clicked" ){
    nID = ID_OK
    }else( "Cancel button clicked" ){
    nID = ID_CANCEL
    }


    and in your client side , do like this

    WrapperClass myWrapper = new WrapperClass();
    myWrapper.show();

    if( myWrapper.nID == WrapperClass.ID_OK ){
    // do your stuff here...
    }

    Have a good day..

    Poochi


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured