[Gambas-devel] Close Windows with gb.form.mda goes woes :(

Ron Onstenk ronstk at ...124...
Fri Aug 11 15:56:02 CEST 2006


On Thursday 10 August 2006 14:16, Benoit Minisini wrote:
> > Ron
> 
> Cheer up!

I try

> 
> I don't understand why you have to change anything in the closing process 
> between gb.form.mda and gb.form.mdi. It should be exactly the same. 

But it looks to me it is not.
Which part do you mean exactly?

> 
> The difference between the two components is just that gb.form.mdi show the 
> MDI windows in a resizable box with a title like a true window, and not in a 
> tab.

Yes I know but that resizable box must blown away on a close.
This can be invisible or blown out memory.
The FTest used by FMain in the gb.form.mdi has persistent=false. 
The IDE uses for code FEdit persistent=true.
Thanks Fabien for the info about that. 
It did solve the problem partial.

And that are the ones giving me the problems.
 
But I do not understand what is going on here in your code

PUBLIC SUB Remove(hWin AS Window)
  
  DIM iInd AS Integer = GetIndex(hWin)

  IF hWin.Close() THEN RETURN  ' <--- A

  IF $hCurrent = $aWindow[iInd] THEN $hCurrent = NULL ' <--- B

  $aWindow.Remove(iInd)   ' <--- C

  IF $aWindow.Count THEN
 '   tabWorkspace[iInd].Delete '<---- D
  ELSE
    tabWorkspace.Hide
    Form_Resize
  ENDIF
  
  Activate
  
END

A)
This triggers Watcher_Close some way.
Watcher_close calls Remove(LAST.Parent) which should be the Window that is Closed.
The persistent is hidden instead of delete from memory. Grrr :<(

I see here remove>watchr>remove>watcher ???
Does a Window.Close set the Widow.Hidden to True when persistent is True ?
Under which conditions does hWin.Close() return true or false and why ?
<note>
  One of the nasty things in gambas versus VB counts here.
  For gambas you can say generally that a Return of True means ERROR.
  For VB the logic is a Return of True means OK all done well.

  Does here hWin.Close() return True mean OK or True mean Error?
</note>


B)
What does '$hCurrent = NULL' really ?
In $hCurrent.Window is the reference for the Window with FWorkspace.Add(mywindow)
By setting to NULL is then a close for $hCurrent.Window done and Watcher_Close fired?


C)
iInd should here be the sequential number in the $aWindow array for the Window.
The content of that item has the pointers to the Window and the 'resizable box'
If this item is removed then the little box must also be gone and must be done 
before $aWindow.Remove(iInd).

The window however still exist on the panWorkspace in the .mdi but is hidden
for the gambas IDE.

( The panWorkspace are the 'resizable box' as 'wsfra' in .mda for each Window )



After all puzzle around I think the 'resizable box' removing from the workspace area
must be done here in Remove().
But one condition count. Watcher_Close must executed without any restrictions
of persistent is true or false.

My button Close does only check that it belong to the active Window.
Then it does the same as your btnClose_Click()

Still need to find the point to hide the window,
and where the tabs on the TabStrip are decremented.

Ron

PS
For asking help this is the only place for me regarding gambas.
I do not have any backup from other people, with programming experience, 
for a quick talk or "Please look what I oversee here".
I have to do it all alone. :(

PS2
Regarding my English grammar. It is 40 years back I learned on school.
The level of education was more of amateur kind and not professional.
I have no practice experience for conversations.
Reading are only technical publications, many times also grammar disasters.
When I compare to others here on the list, not native English speaking people,
I think it is not so worse what I produce. 
Sorry but the grammar rules are more or less unknown for me.

Ron







More information about the Devel mailing list