Author Topic: Dual monitors (PC)  (Read 4518 times)

Phrog30

  • Guest
Dual monitors (PC)
« on: September 26, 2017, 07:01:41 PM »
Has anyone done a project with dual monitors from a desktop PC?  If so, I would love to know how it was setup.  I'm in the process of doing one and wanted to pick some brains.


Thanks,
James

timryder

  • Jr. Member
  • **
  • Posts: 84
  • Still trying to figure it out
    • View Profile
Re: Dual monitors (PC)
« Reply #1 on: September 27, 2017, 10:02:25 AM »
What are you looking to learn? What questions would you have?
I have used it with dual monitors before yes, but it doesn't really change anything?
Still just trying to figure out this thing called Life.

steves0118

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Dual monitors (PC)
« Reply #2 on: September 27, 2017, 03:02:27 PM »
If Phrog is asking if you can simply set both monitors to the same resolution and double the width of the form, the answer is yes.

If he is asking to run two separate AHMI applications concurrently, he will have to wait for someone with more experience to answer.

Phrog30

  • Guest
Re: Dual monitors (PC)
« Reply #3 on: September 27, 2017, 04:57:52 PM »
I will not run as separate applications.

What I'm asking is the people that did multiple monitors, how did you do it. Example, did you simply span across both monitors with one form? Or, each monitor was a form maximized. My applications use a header and footer. So, would you have two instances of the header and footer, or do brute force and create a header/footer for the primary screen and one for the secondary screen. Right now I use mdiparent for touch applications. I don't think that is the way to go in this case. Do you allow the same form to be opened up at the same time on each screen.

Those are the kind of questions I currently have and was wondering what others have done.

Phrog30

  • Guest
Re: Dual monitors (PC)
« Reply #4 on: September 29, 2017, 03:13:19 PM »
I think I have found a good solution.  Instead of using MDIParent I found using a panel in place of the parent container works just as well.  I simply add controls(form) into the proper panel by which screen called the form.  There are still some other unknowns, for example, where do you display message boxes?  For generic messages I guess display on the primary display, but if the message was generated from the secondary display then I need to find a clean way of doing this.  So, I have a parent per screen, but all of the displays are universal, meaning I don't have to make a display for each screen, which makes it very easy to maintain this application.  I have an option to allow only one form open across both displays, or allow to open multiple.  So far so good!

James

Phrog30

  • Guest
Re: Dual monitors (PC)
« Reply #5 on: September 29, 2017, 05:56:33 PM »
I forgot about disposing of the forms that I add to the panel.  I thought this would be easy but it takes several seconds to dispose of one form.  Here's what I'm using now:
Code: [Select]
       
                Dim x As Form
                x = CallForm.GetFormByName(m_FormToOpen.Name)
                If x IsNot Nothing Then
                    _0000_Main_Parent.lbl_Display_Name.Text = x.Text
                    x.TopLevel = False
                    _0000_Main_Parent.pnlParent.Controls.Add(x)
                    x.Show()
                    x.BringToFront()
                    x.Focus()
                    'Remove all but this control (form), do last to prevent blinking
                    For i = 0 To _0000_Main_Parent.pnlParent.Controls.Count - 1
                        If i > 0 Then
                            Dim ctrlName = _0000_Main_Parent.pnlParent.Controls.Item(i).Name
                            _0000_Main_Parent.pnlParent.Controls.Item(ctrlName).Dispose()
                        End If
                    Next
                End If

If I comment out the dispose, it's quick as quick could be, but once I let it dispose, it takes seconds to complete.  Any ideas and what is wrong and/or how I could do it different?

James

Phrog30

  • Guest
Re: Dual monitors (PC)
« Reply #6 on: September 30, 2017, 09:53:26 PM »
I think I'm getting there, one thing I can't seem to get is form.owner.  I have reusable popups that when I display I set the owner.  I like the way this works.  But, on a dual monitor system if I want to open this popup from another display I want to display on the parent where the call button is.  I would have though simply changing the owner would work, but doesn't.  Is there a trick to changing the form owner?  Note, I don't close these popups, but hide them so they open faster next time, plus they open in the same spot they were closed.  Any tips on this is much appreciated.

James

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Dual monitors (PC)
« Reply #7 on: October 04, 2017, 08:56:18 PM »
I am not sure if this is any related to what you are doing or asking about but check the idea Archie is using here:

http://advancedhmi.com/forum/index.php?PHPSESSID=b16bab674b77c83269a4a0c198469230&topic=1516.0

Phrog30

  • Guest
Re: Dual monitors (PC)
« Reply #8 on: October 04, 2017, 09:16:12 PM »
I am not sure if this is any related to what you are doing or asking about but check the idea Archie is using here:

http://advancedhmi.com/forum/index.php?PHPSESSID=b16bab674b77c83269a4a0c198469230&topic=1516.0
Thanks, but that's not what I was looking for. I have since gotten things figured out to a point. I may post what I have when I get further along.

Phrog30

  • Guest
Re: Dual monitors (PC)
« Reply #9 on: November 07, 2017, 10:00:59 AM »
Here's a link to an application that has multi-monitor support (up to 4):
https://drive.google.com/file/d/1FbSYQPQQAKJ13ZVo-Y7B8inKqjg3zXUj/view?usp=sharing

The forms display automatically if you have a multiple monitor setup.  If you only have 1, then it will only display one.  I use mdiparent.  Right now I have the initial forms hard coded.

James

timryder

  • Jr. Member
  • **
  • Posts: 84
  • Still trying to figure it out
    • View Profile
Re: Dual monitors (PC)
« Reply #10 on: November 08, 2017, 03:59:51 PM »
You have all kinds of errors when you build this project.
Still just trying to figure out this thing called Life.

Phrog30

  • Guest
Re: Dual monitors (PC)
« Reply #11 on: November 08, 2017, 04:12:40 PM »
I'm using VS2017, so if you aren't, I could see how you may have issues.  The newer software is more lenient.  For example, this works in VS2017:

Code: [Select]
Using cnn As New SQLiteConnection(connBuilder.ToString())
            Using Comm As New SQLiteCommand()
                With Comm
                    .Connection = cnn
                    .CommandText = "CREATE TABLE IF NOT EXISTS [Security] ( [Id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
                                       [UserName] TEXT NULL, [Password] TEXT NULL, [DisplayName] TEXT NULL, [Level] TEXT NULL )"
                    .CommandType = CommandType.Text
                End With
                Try
                    cnn.Open()
                    Comm.ExecuteNonQuery()
                    cnn.Close()
                Catch
                End Try
            End Using
        End Using


But, in VS2013, it chokes on:
Code: [Select]
.CommandText = "CREATE TABLE IF NOT EXISTS [Security] ( [Id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
                                       [UserName] TEXT NULL, [Password] TEXT NULL, [DisplayName] TEXT NULL, [Level] TEXT NULL )"
since the line is split.  I tried to remember to fix those, but obviously forgot a few.  So, either run VS2017, or strip out all of the stuff giving you errors.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Dual monitors (PC)
« Reply #12 on: November 08, 2017, 09:05:02 PM »
Here are 5 files from this project which I corrected in order to have it start in VS2013.

When the project is open in Visual Studio, it should be sufficient to right-click each of the folders and add the corresponding file(s) as existing item and replace them.
« Last Edit: November 08, 2017, 09:13:58 PM by Godra »