B4J Question Strange glitch with class modules and forms

Discussion in 'B4J Questions' started by agb2008, Jun 15, 2015.

  1. agb2008

    agb2008 Member Licensed User

    I've got strange results while trying to port my B4A app to B4J. Application consists on main module and few classes. Each class got separate form i.e. MsgBox type form e.t.c. that I use in my application. Problem noted when I am trying to call one class from another one. I.e. I've got a form and doing some input values check and in case of error call another class which simulated MsgBox type window. Resulting window displayed properly - but... I could only close it by clicking on red cross in the top right corner of that windows. Button that suppose to close that windows i.e.:
    Code:
    Sub btnCancel_Action
        tform.Close
    End Sub
    For some strange reason does not work...
    But if I call exactly the same class from main application code - everything seems to be fine...
    Could you please advice - am I missing something or it just designed to work that way ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Hard to say without running the code...
     
  3. agb2008

    agb2008 Member Licensed User

    Erel,

    Thank you for reply. I've created a simple test project where I could reproduce my error. Just choose any button - by defaul either error message or another form would be openned - but then for some strange reason I could only close that form window by clicking on red cross icon in the top right corner of the window. Selecting Close button that called "form.close" code does not work for me any more for some strange reason. Apart from installing B4J v 3.0.0 and later update to 3.0.2 - no software changes were made on my computer... Could you please advice ?

    Thank you beforehand,
    Regards,
    Alexey
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    You are handling both MouseClicked and Action events (in the main module and in the class). It causes two dialogs to appear at once. Remove one of these calls and it will work.
     
  5. agb2008

    agb2008 Member Licensed User

    Erel,

    Thank you very much for solving this issue ! :) That was indeed my mistake to add both events handlers... Do not remember why exactly I add them - but I was
    unable to spot that both even handlers could cause such problem.

    Regards,
    Alexey

     
Loading...