hide form

Post

Posted
Rating:
#1 (In Topic #895)
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
I want to hide a form. And I have chosen to use these lines of code. Would that be the correct way, thanks.

Code (gambas)

  1.          ' hide a form
  2.          Me.Opacity = 0
  3.          Me.Minimized = True
  4.  
  5.          ' show a application
  6.          FMain.Show
  7.  

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’

gambafeliz said

I want to hide a form. And I have chosen to use these lines of code. Would that be the correct way, thanks.

Code (gambas)

  1.          ' hide a form
  2.          Me.Opacity = 0
  3.          Me.Minimized = True
  4.  
  5.          ' show a application
  6.          FMain.Show
  7.  

         ' hide a "Main" form
         FMain.Hide
or
        FMain.Visible = False

If you need to keep the data in the form alive then set the forms Persistent = True
If the window is not the Application main window then you can just use MyFormName.Close()

If window is not persistent then the fields will need to be filled on each load/open or if it is persistent then the fields will be filled/accessible even when form is hidden/closed
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
 Just a note:
How you re-open the window (what your app does while the window is closed) is important to how you can close it.

Ie. if the window is re-opened by using a trayicon click or something then you could just use Me.Close and Me.Show as the application will not quit until you close your trayicon.

You can use Me.Close on the main application window as long as there is something keeping your program alive like a timer event, trayIcon, another open window or an open file handle, etc. (And the forms Persistent property is True)

Hope that makes sense
Online now: No Back to the top

Post

Posted
Rating:
#4
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
 Thanks a lot

But I don't know what happens in my application. "Hide" does not work and "Visible" does not work.

I do not understand why.

I describe what I have done. I had a main window, this has become just a window without more. And I have created a new Form that has taken as main.

And when I hide the main window to "show" the next one, "neither Hide nor Visible" works.

Why? no idea. maybe the order of the final Show?

Note: From my previous post, I have the feeling that my application is contaminated since I changed the main form for another.

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
Without seeing your code it is hard to guess.

The above mentioned code all works as expected for me here so there must be a glitch in your code somewhere keeping the window open or reopening it.

Post your project and we will soon get to the problem :)
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’
If the above code is being run from FMain.class then  Me and FMain are the same thing.
So this..

Code (gambas)

  1.  
  2. ' hide a form
  3. Me.Opacity = 0
  4. Me.Minimized = True
  5.  
  6. ' show a application
  7. FMain.Show
  8.  
  9.  

Just closes and re-opens FMain
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
 You should use this order…

Create new form (say it's name is MyForm) in your FMain.class
MyForm = New Form

Initialise new form and open it with
MyForm.Show()
then
FMain.Hide (or Me.Hide if the code is in FMain.class)
Online now: No Back to the top

Post

Posted
Rating:
#8
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
 I clarify
Me = frmSetup (it is Main Form)
FMain = (It is no longer the main one) it is simply a Form that I call from frmSetup

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top

Post

Posted
Rating:
#9
Guru
BruceSteers is in the usergroup ‘Guru’
 Clearly, I cannot guess what is going wrong and i will waste too much time trying to guess.
post your project.

here's something that simply does what you are describing..

Attachment
Online now: No Back to the top

Post

Posted
Rating:
#10
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
thank you Bruce Steers for your kind effort.  :)

But although your code is what I am looking for it is impossible for me to implement it in my project.

And I'm sorry to tell you that I don't want to share my project. It is something very personal.

I think for sure. That Gambas3 has messed up and I have broken the project. Because things like "Hide" and other things don't work. In any case, I will continue studying my problem and in the end I will tell you, what happened?

Thank you

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top

Post

Posted
Rating:
#11
Guru
BruceSteers is in the usergroup ‘Guru’
 Can you copy your project and remove anything personal from the copy, then post what's left?

you could remove everything except the window hide/show functions

If not, best of luck.
Online now: No Back to the top

Post

Posted
Rating:
#12
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
 Yes, I am going to do it, although I think it will take time. It is a project for me already gigantic.

Right now I have discovered, but I don't have the solution, that it is a recursion problem.

Where, I open a main window that detects that it should automatically open another window, but when this last window, I call the main window myself with a button, the main window detects the same thing and continues the cycle until it stays or in the second window or close, because I'm a mess myself.

How crazy, right?

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top

Post

Posted
Rating:
#13
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
 Eureka

I think I've found the solution, although I'm still trying to get it to work.

First, it is not a problem of the wonderful Gambas3, I reaffirm myself, wonderful.

Second, it's my fault and mine alone. The problem is mainly that I lack knowledge, basically it is a knowledge problem on my part.

I have created a pseudocode in my language and when going through it, I have detected that everything is poorly developed. To the point that now FMain is again the start of the project and the Form for loading the database and the configuration is a form that will be called with Show and will be closed with Close, and nothing else.

At the moment I am implementing it, I will continue telling it in case this is a new design error on my part.

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top
1 guest and 0 members have just viewed this.