Page 1 of 2

Problems with Message and the window that creates it

Posted: Saturday 26th November 2022 2:19pm
by gambafeliz
Problems with Message and the window that creates it.

I explain it:

I have an initial Form, it loads (launches) another form in front of it (called F1), Now this F1 form launches a Message with a request for a response. But what happens to me is that the F1 form is hidden and only the Initial Form + the Message remains. I want everything to look like this: Initial form and above it the F1 form and above it the Message. This is possible? Or do I have to create a question and answer system statically in the F1 form and thus have all the control myself.

Re: Problems with Message and the window that creates it

Posted: Saturday 26th November 2022 5:22pm
by cogier
Try putting Me.Show before you open F1 and again before displaying the Message.

Re: Problems with Message and the window that creates it

Posted: Sunday 27th November 2022 12:38am
by BruceSteers
I assume you are using the message command in the form.open event?

That won't work as the form.must open first.

Best way is to create a timer and start it in the form open event.

Have the timer event use the message command and form.open can continue to work

Private hTimer as Timer
Public sub Form_Open()
hTimer = New Timer As "Ttimer"
hTimer.Delay = 0
hTimer.Start
End

Public Sub Ttimer_Timer()
Last.Stop 
Wait 0.1 ' might not need this line but a Wait can help.
Message.Question("question")
End


Re: Problems with Message and the window that creates it

Posted: Sunday 27th November 2022 6:08am
by gambafeliz
Thank you both, I greatly appreciate your help.

I don't know if I should apologize or not. Because I think I have explained it very badly. I apologize just in case. Forgiveness.

I am programming in the IDE and I am not explaining something that happens in an executable program.

So situate yourselves, I'm in the IDE and I do F5

1. Load the FMain.
2. The FMain loads a Form called form1
3. The form1 launches Message to ask with two Yes or No buttons

And right there the form1 disappears and only the IDE and Message remain on the screen but the FMain and form1 are lost from the screen

My question:
Is this normal in the programming environment?
Does this also happen to me if I make the program executable without using the IDE?
Should I dialogue with the user with a personal development instead of Message to avoid these little problems?

Thank you and I hope I have explained it better than before.

Re: Problems with Message and the window that creates it

Posted: Sunday 27th November 2022 11:02am
by BruceSteers
No that's your coding.
Nothing should hide form automatically.

If form hides it's your code.

Post an example program.

Re: Problems with Message and the window that creates it

Posted: Sunday 27th November 2022 12:43pm
by gambafeliz
BruceSteers wrote: Sunday 27th November 2022 11:02am No that's your coding.
Nothing should hide form automatically.

If form hides it's your code.

Post an example program.
As is normal for you, you are right friend BruceSteers

I have tried with ShowModal(), I always use Show() and it has fixed the problem. And also the graphical user interface now seems more solid and serious for the user.

Goodness :)

Hey seriously I wish you a nice day. Thanks.

Re: Problems with Message and the window that creates it

Posted: Sunday 27th November 2022 3:53pm
by cogier
I assume you are using the message command in the form.open event?

That won't work as the form.must open first.

Best way is to create a timer and start it in the form open event.

Have the timer event use the message command and form.open can continue to work
Private hTimer as Timer
Public sub Form_Open()
hTimer = New Timer As "Ttimer"
hTimer.Delay = 0
hTimer.Start
End
 
Public Sub Ttimer_Timer()
  
Last.Stop 
Wait 0.1 ' might not need this line but a Wait can help.
Message.Question("question")
End
You could simplify this a little using the Trigger command: -

Public Sub Form_Open()

  Dim hTimer As Timer

  hTimer = New Timer As "Timer1"
  hTimer.Trigger

End

Public Sub Timer1_Timer()

  Message.Question("question")

End

Re: Problems with Message and the window that creates it

Posted: Sunday 27th November 2022 5:49pm
by gambafeliz
Thank you very much cogier

Re: Problems with Message and the window that creates it

Posted: Wednesday 30th November 2022 6:07am
by gambafeliz
Hello, as I have already said, I have solved it with ShowModal, but is it possible to make the form open or change it to Modal or non-Modal on the fly? It would solve a big problem that I have. Thanks.

Re: Problems with Message and the window that creates it

Posted: Friday 2nd December 2022 12:01pm
by thatbruce
gambafeliz wrote: Wednesday 30th November 2022 6:07am but is it possible to make the form open or change it to Modal or non-Modal on the fly?
Not in this universe.
There are many things you can't change "on the fly" when using a GUI, the basic reason is that once the Gambas executable is "started" from your codes perspective it has already committed to a life long "partnership". Thus, you can't change the GUI, it's handlers, and many other things. But for future references you may care to look at the "Utility" property of your forms. (Actually, I'll be damned if I can work out what it does exactly, but it has caught me out more times than I care to admit.)
hth
b