Loading ...
Sorry, an error occurred while loading the content.
 

Does anyone know?

Expand Messages
  • Harry
    Do modal dialog boxes ope in the middle of the display regardless of the code-set valuse of UpperLeftX and ...Y? Figured I d ask before I spent a lot of time
    Message 1 of 9 , Jul 2, 2012
      Do modal dialog boxes ope in the middle of the display regardless of the code-set valuse of UpperLeftX and ...Y? Figured I'd ask before I spent a lot of time looking for a non-existent glitch.

      Thanks,
      Harry
    • Stefan Pendl
      ... Modal dialogs are designed as support windows and not as main GUI windows. The position is relative to the client-areas top-left corner of the previously
      Message 2 of 9 , Jul 2, 2012
        Am 02.07.2012 17:48, schrieb Harry:
        > Do modal dialog boxes ope in the middle of the display regardless of the code-set valuse of UpperLeftX and ...Y? Figured I'd ask before I spent a lot of time looking for a non-existent glitch.
        >

        Modal dialogs are designed as support windows and not as main GUI windows.
        The position is relative to the client-areas top-left corner of the
        previously opened window.

        Open a regular window of type window and then open a modal dialog while
        the other window is still open using the position 1 and 1.

        Notice the modal dialog is located in the top-left corner of the
        previous window.

        This is how they have to be used, any other use is in contrary of what
        they are designed for.


        --
        Stefan Pendl
        http://stefanpendl.runbasichosting.com/

        LB 4.04 Pro ... http://www.libertybasic.com/assist.html
        LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

        LB Community Wiki .............. http://basic.wikispaces.com/
        LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
        LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

        Books at http://www.lulu.com/ and http://www.amazon.com/
        Alyce Watson ... APIs for Liberty BASIC
        Carl Gundel .... Beginning Programming with Liberty BASIC

        Windows 7 Home Premium 64-bit SP1
        AMD Turion X2 RM-70 2GHz, 4GB RAM
      • Sam
        Modal dialogs may open in the upper left of the controlling window if you use position 1, 1, but for other values I have found the position largely random, and
        Message 3 of 9 , Jul 2, 2012
          Modal dialogs may open in the upper left of the controlling window if you use position 1, 1, but for other values I have found the position largely random, and not always repeatable.

          There are some other strange behaviors of controls on modal windows, such as radio buttons. Also, the idea of a modal dialog is to force the user to deal with it before returning to the controlling window. But if you carry it too far, with window A opening modal dialog B which opens modal dialog C, it suddenly becomes possible to activate window A without closing B and C.

          Bottom line, you should probably avoid modal dialogs and simply deactivate window A as soon as window B is opened, then reactivate it when B is closed.

          Sam W.

          --- In libertybasic@yahoogroups.com, Stefan Pendl <pendl2megabit@...> wrote:
          >
          > Am 02.07.2012 17:48, schrieb Harry:
          > > Do modal dialog boxes ope in the middle of the display regardless of the code-set valuse of UpperLeftX and ...Y? Figured I'd ask before I spent a lot of time looking for a non-existent glitch.
          > >
          >
          > Modal dialogs are designed as support windows and not as main GUI windows.
          > The position is relative to the client-areas top-left corner of the
          > previously opened window.
          >
          > Open a regular window of type window and then open a modal dialog while
          > the other window is still open using the position 1 and 1.
          >
          > Notice the modal dialog is located in the top-left corner of the
          > previous window.
          >
          > This is how they have to be used, any other use is in contrary of what
          > they are designed for.
          >
          >
          > --
          > Stefan Pendl
          > http://stefanpendl.runbasichosting.com/
          >
          > LB 4.04 Pro ... http://www.libertybasic.com/assist.html
          > LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe
          >
          > LB Community Wiki .............. http://basic.wikispaces.com/
          > LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
          > LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/
          >
          > Books at http://www.lulu.com/ and http://www.amazon.com/
          > Alyce Watson ... APIs for Liberty BASIC
          > Carl Gundel .... Beginning Programming with Liberty BASIC
          >
          > Windows 7 Home Premium 64-bit SP1
          > AMD Turion X2 RM-70 2GHz, 4GB RAM
          >
        • Stefan Pendl
          ... Dialog windows inherit the DPI settings of the screen for their position, see http://libertybasicbugs.wikispaces.com/DIALOG-wrong+position Modal dialogs
          Message 4 of 9 , Jul 2, 2012
            Am 03.07.2012 02:14, schrieb Sam:
            > Modal dialogs may open in the upper left of the controlling window if you use position 1, 1, but for other values I have found the position largely random, and not always repeatable.
            >

            Dialog windows inherit the DPI settings of the screen for their
            position, see http://libertybasicbugs.wikispaces.com/DIALOG-wrong+position

            Modal dialogs shouldn't be affected, but I don't know your environment,
            where that happened.

            > There are some other strange behaviors of controls on modal windows, such as radio buttons. Also, the idea of a modal dialog is to force the user to deal with it before returning to the controlling window. But if you carry it too far, with window A opening modal dialog B which opens modal dialog C, it suddenly becomes possible to activate window A without closing B and C.
            >

            I haven't encountered any of those two situations, would you mind
            setting up an example to duplicate that problem?
            Detailed steps to reproduce it and the environment you are running on
            would be needed too.

            > Bottom line, you should probably avoid modal dialogs and simply deactivate window A as soon as window B is opened, then reactivate it when B is closed.
            >

            Why would one like to have such a complicate way of doing things, when
            Windows is offering modal dialogs?


            --
            Stefan Pendl
            http://stefanpendl.runbasichosting.com/

            LB 4.04 Pro ... http://www.libertybasic.com/assist.html
            LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

            LB Community Wiki .............. http://basic.wikispaces.com/
            LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
            LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

            Books at http://www.lulu.com/ and http://www.amazon.com/
            Alyce Watson ... APIs for Liberty BASIC
            Carl Gundel .... Beginning Programming with Liberty BASIC

            Windows 7 Home Premium 64-bit SP1
            AMD Turion X2 RM-70 2GHz, 4GB RAM
          • Harry
            Thank you Stephan and Sam! It all becomes clear when you have good information. Sam, in other settings I have done what you suggested and disabled the
            Message 5 of 9 , Jul 3, 2012
              Thank you Stephan and Sam! It all becomes clear when you have good information.

              Sam, in other settings I have done what you suggested and disabled the controlling window when an outboard dialog has to be opened, and opened the dialog as non-modal. That does give me control over the position of the dialog. In this instance, it's cleaner (and simpler) to use a modal, and there won't be any children of that one to confuse the operating system.

              Harry

              --- In libertybasic@yahoogroups.com, Stefan Pendl <pendl2megabit@...> wrote:
              >
              > Am 03.07.2012 02:14, schrieb Sam:
              > > Modal dialogs may open in the upper left of the controlling window if you use position 1, 1, but for other values I have found the position largely random, and not always repeatable.
              > >
              >
              > Dialog windows inherit the DPI settings of the screen for their
              > position, see http://libertybasicbugs.wikispaces.com/DIALOG-wrong+position
              >
              > Modal dialogs shouldn't be affected, but I don't know your environment,
              > where that happened.
              >
              > > There are some other strange behaviors of controls on modal windows, such as radio buttons. Also, the idea of a modal dialog is to force the user to deal with it before returning to the controlling window. But if you carry it too far, with window A opening modal dialog B which opens modal dialog C, it suddenly becomes possible to activate window A without closing B and C.
              > >
              >
              > I haven't encountered any of those two situations, would you mind
              > setting up an example to duplicate that problem?
              > Detailed steps to reproduce it and the environment you are running on
              > would be needed too.
              >
              > > Bottom line, you should probably avoid modal dialogs and simply deactivate window A as soon as window B is opened, then reactivate it when B is closed.
              > >
              >
              > Why would one like to have such a complicate way of doing things, when
              > Windows is offering modal dialogs?
              >
              >
              > --
              > Stefan Pendl
              > http://stefanpendl.runbasichosting.com/
              >
              > LB 4.04 Pro ... http://www.libertybasic.com/assist.html
              > LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe
              >
              > LB Community Wiki .............. http://basic.wikispaces.com/
              > LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
              > LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/
              >
              > Books at http://www.lulu.com/ and http://www.amazon.com/
              > Alyce Watson ... APIs for Liberty BASIC
              > Carl Gundel .... Beginning Programming with Liberty BASIC
              >
              > Windows 7 Home Premium 64-bit SP1
              > AMD Turion X2 RM-70 2GHz, 4GB RAM
              >
            • Sam
              I detailed the problem in message 37913 and subsequent. The most troublesome aspect is that a radio button event can be invoked immediately after the dialog is
              Message 6 of 9 , Jul 3, 2012
                I detailed the problem in message 37913 and subsequent. The most troublesome aspect is that a radio button event can be invoked immediately after the dialog is closed, which makes no sense at all.

                (By the way, I have discovered that such delayed events can also occur when opening a dialog. For example, say you have Window A open and you select a menu, such that the menu list partly covers Window A. You then click on one of the listed menu items, which opens a dialog. If you happen to double-click on the menu item (being spastic like myself), the dialog will open but then a double-click event is generated for Window A (because Window A was under the menu). If the dialog is opened in a true subroutine but the double-click event is handled through a branch label, the branch label will be unknown within the subroutine and a crash occurs.)

                I suspect these event-timing problems are due to LB, not Windows.

                As to the question "why not use modal dialogs?" Because they don't locate where you want them and they crash when used with certain controls. And in certain cases they cease to be "modal".

                Sam W.

                --- In libertybasic@yahoogroups.com, Stefan Pendl <pendl2megabit@...> wrote:
                >
                > Am 03.07.2012 02:14, schrieb Sam:
                > > Modal dialogs may open in the upper left of the controlling window if you use position 1, 1, but for other values I have found the position largely random, and not always repeatable.
                > >
                >
                > Dialog windows inherit the DPI settings of the screen for their
                > position, see http://libertybasicbugs.wikispaces.com/DIALOG-wrong+position
                >
                > Modal dialogs shouldn't be affected, but I don't know your environment,
                > where that happened.
                >
                > > There are some other strange behaviors of controls on modal windows, such as radio buttons. Also, the idea of a modal dialog is to force the user to deal with it before returning to the controlling window. But if you carry it too far, with window A opening modal dialog B which opens modal dialog C, it suddenly becomes possible to activate window A without closing B and C.
                > >
                >
                > I haven't encountered any of those two situations, would you mind
                > setting up an example to duplicate that problem?
                > Detailed steps to reproduce it and the environment you are running on
                > would be needed too.
                >
                > > Bottom line, you should probably avoid modal dialogs and simply deactivate window A as soon as window B is opened, then reactivate it when B is closed.
                > >
                >
                > Why would one like to have such a complicate way of doing things, when
                > Windows is offering modal dialogs?
                >
                >
                > --
                > Stefan Pendl
                > http://stefanpendl.runbasichosting.com/
                >
                > LB 4.04 Pro ... http://www.libertybasic.com/assist.html
                > LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe
                >
                > LB Community Wiki .............. http://basic.wikispaces.com/
                > LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
                > LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/
                >
                > Books at http://www.lulu.com/ and http://www.amazon.com/
                > Alyce Watson ... APIs for Liberty BASIC
                > Carl Gundel .... Beginning Programming with Liberty BASIC
                >
                > Windows 7 Home Premium 64-bit SP1
                > AMD Turion X2 RM-70 2GHz, 4GB RAM
                >
              • green8819
                Do modal dialog boxes open in the middle of the display regardless of the code-set valuse of UpperLeftX and ...Y? As established by learned members in recent
                Message 7 of 9 , Jul 3, 2012
                  "Do modal dialog boxes open in the middle of the display regardless of the code-set valuse of UpperLeftX and ...Y?"

                  As established by learned members in recent posts, no.

                  Windows of type, "dialog_modal" are positioned relative to the parent window. I myself just learnt this.

                  So, If I position the parent window correctly, I can have my dialog_modal windows ANYWHERE.

                  The code below is using 2 extra windows to facilitate relative positioning of text display. The same result can be achieved by using 3 regular windows, but positioning of text display would be absolute to the respective windows.

                  Although GOSUB may be antiquated, I still prefer it because it is uncomplicated and reliable.

                  There are startling finds in the site referred to by Stefan.
                  For example,
                  int((DisplayWidth-WindowWidth)/2)
                  int((DisplayHeight-WindowHeight)/2)
                  is not really centred

                  '----code start
                  nomainwin
                  'global name$ 'not necessary since gosub is used
                  WindowWidth = 200 :WindowHeight = 200
                  UpperLeftX=int((DisplayWidth-WindowWidth)/2) :mainLeftX=UpperLeftX
                  UpperLeftY=int((DisplayHeight-WindowHeight)/2) :mainLeftY=UpperLeftY
                  statictext #m.st, "Name :", 45, 22, 107, 15
                  statictext #m.num, "Number :", 45, 82, 107, 15
                  textbox #m.name, 45, 37, 100, 25
                  textbox #m.numb, 45, 97, 100, 25
                  button #m.ok,"OK",[ok], UL, 70, 137, 50, 25
                  open "Main Window" for dialog as #m
                  #m, "trapclose [quit.m]"
                  #m.name, "!setfocus"
                  wait

                  [ok]
                  #m.name, "!contents? name$"
                  #m.numb, "!contents? numb$"
                  gosub [DisplayDialogWindows]
                  wait

                  [quit.m]
                  if d1$="open" then close #d1 :close #dmain1
                  if d2$="open" then close #d2 :close #dmain2
                  close #m
                  END
                  '------------------------------------------
                  [DisplayDialogWindows]
                  WindowWidth = -20 :WindowHeight = -20
                  UpperLeftX=mainLeftX-205 :UpperLeftY=mainLeftY-25
                  open "d1" for window as #dmain1
                  dmain1$="open"
                  WindowWidth = 200 :WindowHeight = 200
                  UpperLeftX = 1:UpperLeftY = 1
                  statictext #d1.name, name$, 45, 37, 100, 25
                  open "Modal 1" for dialog_nf_modal as #d1
                  #dmain1,"hide"
                  d1$="open"
                  #d1.name, name$
                  '----
                  WindowWidth = -20 :WindowHeight = -20
                  UpperLeftX=mainLeftX+195 :UpperLeftY=mainLeftY-25
                  open "d2" for window as #dmain2
                  dmain2$="open"
                  WindowWidth = 200 :WindowHeight = 200
                  UpperLeftX = 1:UpperLeftY = 1
                  statictext #d2.numb, numb$, 45, 97, 100, 25
                  open "Modal 2" for dialog_nf_modal as #d2
                  #dmain2,"hide"
                  d2$="open"
                  #d2.numb, numb$
                  return
                  '----code end
                • Stefan Pendl
                  ... The code below shows how one would center the modal dialog over the main application window. ---code start (watch for line wraps) nomainwin MainWinWidth =
                  Message 8 of 9 , Jul 4, 2012
                    Am 04.07.2012 06:23, schrieb green8819:
                    >
                    > "Do modal dialog boxes open in the middle of the display regardless of the code-set valuse of UpperLeftX and ...Y?"
                    >

                    The code below shows how one would center the modal dialog over the main
                    application window.


                    '---code start (watch for line wraps)

                    nomainwin

                    MainWinWidth = 800
                    MainWinHeight = 600

                    WindowWidth = MainWinWidth
                    WindowHeight = MainWinHeight

                    UpperLeftX = (DisplayWidth-WindowWidth)/2
                    UpperLeftY = (DisplayHeight-WindowHeight)/2

                    button #m.bt, "Show Dialog", [m.doit], ul, 10, 10
                    open "Move Me" for window as #m
                    #m "trapclose [m.quit]"
                    #m "resizehandler [m.resize]"
                    wait

                    [m.resize]
                    MainWinWidth = WindowWidth
                    MainWinHeight = WindowHeight
                    wait

                    [m.doit]
                    WindowWidth = MainWinWidth * .6
                    WindowHeight = MainWinHeight * .6

                    UpperLeftX = (MainWinWidth-WindowWidth)/2
                    UpperLeftY = (MainWinHeight-WindowHeight)/2

                    open "Close Me" for dialog_modal as #d
                    #d "trapclose [d.quit]"
                    wait

                    [d.quit]
                    close #d
                    wait

                    [m.quit]
                    close #m
                    end

                    '---code end

                    --
                    Stefan Pendl
                    http://stefanpendl.runbasichosting.com/

                    LB 4.04 Pro ... http://www.libertybasic.com/assist.html
                    LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

                    LB Community Wiki .............. http://basic.wikispaces.com/
                    LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
                    LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

                    Books at http://www.lulu.com/ and http://www.amazon.com/
                    Alyce Watson ... APIs for Liberty BASIC
                    Carl Gundel .... Beginning Programming with Liberty BASIC

                    Windows 7 Home Premium 64-bit SP1
                    AMD Turion X2 RM-70 2GHz, 4GB RAM
                  • green8819
                    Please note following 5 corrections: [ok] #m.name, !contents? name$ #m.numb, !contents? numb$ if d1$= open then close #d1 :close #dmain1
                    Message 9 of 9 , Jul 4, 2012
                      Please note following 5 corrections:

                      [ok]
                      #m.name, "!contents? name$"
                      #m.numb, "!contents? numb$"
                      if d1$="open" then close #d1 :close #dmain1 '<----
                      if d2$="open" then close #d2 :close #dmain2 '<----
                      gosub [DisplayModals]'<----
                      wait

                      [quit.m]
                      close #m '<----
                      if d1$="open" then close #d1 :close #dmain1
                      if d2$="open" then close #d2 :close #dmain2
                      END
                      '------------------------------------------
                      [DisplayModals] '<----


                      Thanks.



                      --- In libertybasic@yahoogroups.com, "green8819" <green8819@...> wrote:
                      >
                      >
                      >
                      > "Do modal dialog boxes open in the middle of the display regardless of the code-set valuse of UpperLeftX and ...Y?"
                      >
                      > As established by learned members in recent posts, no.
                      >
                      > Windows of type, "dialog_modal" are positioned relative to the parent window. I myself just learnt this.
                      >
                      > So, If I position the parent window correctly, I can have my dialog_modal windows ANYWHERE.
                      >
                      > The code below is using 2 extra windows to facilitate relative positioning of text display. The same result can be achieved by using 3 regular windows, but positioning of text display would be absolute to the respective windows.
                      >
                      > Although GOSUB may be antiquated, I still prefer it because it is uncomplicated and reliable.
                      >
                      > There are startling finds in the site referred to by Stefan.
                      > For example,
                      > int((DisplayWidth-WindowWidth)/2)
                      > int((DisplayHeight-WindowHeight)/2)
                      > is not really centred
                      >
                      > '----code start
                      > nomainwin
                      > 'global name$ 'not necessary since gosub is used
                      > WindowWidth = 200 :WindowHeight = 200
                      > UpperLeftX=int((DisplayWidth-WindowWidth)/2) :mainLeftX=UpperLeftX
                      > UpperLeftY=int((DisplayHeight-WindowHeight)/2) :mainLeftY=UpperLeftY
                      > statictext #m.st, "Name :", 45, 22, 107, 15
                      > statictext #m.num, "Number :", 45, 82, 107, 15
                      > textbox #m.name, 45, 37, 100, 25
                      > textbox #m.numb, 45, 97, 100, 25
                      > button #m.ok,"OK",[ok], UL, 70, 137, 50, 25
                      > open "Main Window" for dialog as #m
                      > #m, "trapclose [quit.m]"
                      > #m.name, "!setfocus"
                      > wait
                      >
                      > [ok]
                      > #m.name, "!contents? name$"
                      > #m.numb, "!contents? numb$"
                      > gosub [DisplayDialogWindows]
                      > wait
                      >
                      > [quit.m]
                      > if d1$="open" then close #d1 :close #dmain1
                      > if d2$="open" then close #d2 :close #dmain2
                      > close #m
                      > END
                      > '------------------------------------------
                      > [DisplayDialogWindows]
                      > WindowWidth = -20 :WindowHeight = -20
                      > UpperLeftX=mainLeftX-205 :UpperLeftY=mainLeftY-25
                      > open "d1" for window as #dmain1
                      > dmain1$="open"
                      > WindowWidth = 200 :WindowHeight = 200
                      > UpperLeftX = 1:UpperLeftY = 1
                      > statictext #d1.name, name$, 45, 37, 100, 25
                      > open "Modal 1" for dialog_nf_modal as #d1
                      > #dmain1,"hide"
                      > d1$="open"
                      > #d1.name, name$
                      > '----
                      > WindowWidth = -20 :WindowHeight = -20
                      > UpperLeftX=mainLeftX+195 :UpperLeftY=mainLeftY-25
                      > open "d2" for window as #dmain2
                      > dmain2$="open"
                      > WindowWidth = 200 :WindowHeight = 200
                      > UpperLeftX = 1:UpperLeftY = 1
                      > statictext #d2.numb, numb$, 45, 97, 100, 25
                      > open "Modal 2" for dialog_nf_modal as #d2
                      > #dmain2,"hide"
                      > d2$="open"
                      > #d2.numb, numb$
                      > return
                      > '----code end
                      >
                    Your message has been successfully submitted and would be delivered to recipients shortly.