Open gb.Form.Dialog maximised (full screen)

Post your Gambas programming questions here.
Post Reply
bazzvn
Posts: 18
Joined: Wednesday 22nd February 2017 11:06am
Location: Vietnam

Open gb.Form.Dialog maximised (full screen)

Post by bazzvn »

Is it possible to automatically open gb.Form.Dialog full screen (i.e.maximized)? I know it is possible to click on the maximize button after the dialog is opened but this is an unnecessarily annoying extra step to get a better view of the directory structure when looking for a file. If it's not possible then I guess I'll just have to go with a file chooser on a maximized form.

bazzvn
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Open gb.Form.Dialog maximised (full screen)

Post by cogier »

I have had a look at this, and I can't work out how to do this. Sorry.
vuott
Posts: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Open gb.Form.Dialog maximised (full screen)

Post by vuott »

I suggest some resources of the "DesktopWatcher " and "DesktopWindows " Classes by activating the gb.desktop and gb.desktop.x11 Components:
Private wa As DesktopWatcher
Private dw As DesktopWindow


Public Sub Form_Open()

' It watchs all windows, present and future, on the desktop:
  wa = New DesktopWatcher As "DWatch"

End

Public Sub Button1_Click()

  With Dialog
' The "title" of the Dialog window must be certain and unique:
    .Title = "Abcde"
    If .OpenFile() Then Return 
  End With
  
End

Public Sub DWatch_Windows()  ' If the window list on the desktop has changed...
  
' ...then checks if the "Abcde" window has opened:
  If Desktop.FindWindow("Abcde", Null, Null).Count > 0 Then 
' If so, the Dialog window is resized:
    With dw = New DesktopWindow(Desktop.FindWindow("Abcde", Null, Null)[0])
      .Resize(Screen.AvailableWidth, Screen.AvailableHeight)
    End With
  Endif 
  
End
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Open gb.Form.Dialog maximised (full screen)

Post by stevedee »

bazzvn wrote: Sunday 16th May 2021 1:23am ...If it's not possible then I guess I'll just have to go with a file chooser on a maximized form.
Don't know if this helps, but you can make Controls expand when the mouse enters the control.

As an example, open a new project and add a Splitter, put a DirChooser inside on the left and a TextArea inside on the right.
Public Sub Form_Open()

  Splitter1.Layout = [5, 95]
  Splitter1.Expand = True
  TextArea1.Text = "Blah, blah, blah, blah.........................................."

End

Public Sub DirChooser1_Enter()
   
  Splitter1.Layout = [95, 5]
   
End
 
Public Sub DirChooser1_Leave()
   
  Splitter1.Layout = [5, 95]
   
End
When the mouse enters the DirChooser, it is expanded to [almost] the full size of the form.
bazzvn
Posts: 18
Joined: Wednesday 22nd February 2017 11:06am
Location: Vietnam

Re: Open gb.Form.Dialog maximised (full screen)

Post by bazzvn »

Thank you all, especially Vuott. Your code works wonderfully.
The only thing I had to add was 1 line of code after resizing, to reposition the form: .Resize(Screen.AvailableWidth, Screen.AvailableHeight)
.Move(0,0) 'Move the dialog

With best wishes,
bazzvn
Post Reply