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

45210Re: Does anyone know?

Expand Messages
  • green8819
    Jul 3, 2012
    • 0 Attachment
      "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,
      is not really centred

      '----code start
      '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"

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

      if d1$="open" then close #d1 :close #dmain1
      if d2$="open" then close #d2 :close #dmain2
      close #m
      WindowWidth = -20 :WindowHeight = -20
      UpperLeftX=mainLeftX-205 :UpperLeftY=mainLeftY-25
      open "d1" for window as #dmain1
      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
      #d1.name, name$
      WindowWidth = -20 :WindowHeight = -20
      UpperLeftX=mainLeftX+195 :UpperLeftY=mainLeftY-25
      open "d2" for window as #dmain2
      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
      #d2.numb, numb$
      '----code end
    • Show all 9 messages in this topic