03-06-2020 07:33 AM
Hi,
I'm updating some DIAdem 2010 scripts to 2019. I've opened a SUD file in the later version, saved it, and run it, and I find that the comboboxes won't respond to the calls in the code to set their positions in the dialog box. The code is unchanged between the two versions except for a name change to a variable that represents the number of channels in the data file.
The following is a side by side image of the 2010 and 2019 SUD editors (I've attached it in case it's not readable). I can't see any differences to the values; only that some of the boxes are greyed out in the 2010 version. The code changes the top position of each combobox in a loop (code shown below).
The next image is the box as it looks when run in 2010.
The next image is the same box in 2019.
As you can see, the combo boxes remain stacked on top of each other in their starting positions, instead of spaced according to the number of text entries on the left (8).
The code is:
Sub Dialog_EventInitialize(ByRef This) 'Created Event Handler
Dim x
Dim i
Dim NoChan: NoChan = 8
x=80+15*NoChan
Button1.Top = x + 10
Button1.Bottom = x+25
Button2.Top = x + 10
Button2.Bottom = x+25
Dialog.Height = x+35
LatacCorr.Top = x - 20
LatacCorr.Bottom = x
LatacCorr.Visible = 1
LatacCorr.Value = 0
For i = 1 To NoChan-1
Select Case i
Case 1
ChanLabel1.Visible = 1
ChanAction1.Visible = 1
ChanLabel1.Text = CN(i+1)
ChanAction1.Top = 55+(i*15)
ChanLabel1.Top = 55+(i*15)
ChanLabel1.Bottom = 70+(i*15)
Case 2
ChanLabel2.Visible = 1
ChanAction2.Visible = 1
ChanLabel2.Text = CN(i+1)
ChanAction2.Top = 55+(i*15)
ChanLabel2.Top = 55+(i*15)
ChanLabel2.Bottom = 70+(i*15)
Case 3
ChanLabel3.Visible = 1
ChanAction3.Visible = 1
ChanLabel3.Text = CN(i+1)
ChanAction3.Top = 55+(i*15)
ChanLabel3.Top = 55+(i*15)
ChanLabel3.Bottom = 70+(i*15)
Case 4
ChanLabel4.Visible = 1
ChanAction4.Visible = 1
ChanLabel4.Text = CN(i+1)
ChanAction4.Top = 55+(i*15)
ChanLabel4.Top = 55+(i*15)
ChanLabel4.Bottom = 70+(i*15)
Case 5
ChanLabel5.Visible = 1
ChanAction5.Visible = 1
ChanLabel5.Text = CN(i+1)
ChanAction5.Top = 55+(i*15)
ChanLabel5.Top = 55+(i*15)
ChanLabel5.Bottom = 70+(i*15)
Case 6
ChanLabel6.Visible = 1
ChanAction6.Visible = 1
ChanLabel6.Text = CN(i+1)
ChanAction6.Top = 55+(i*15)
ChanLabel6.Top = 55+(i*15)
ChanLabel6.Bottom = 70+(i*15)
Case 7
ChanLabel7.Visible = 1
ChanAction7.Visible = 1
ChanLabel7.Text = CN(i+1)
ChanAction7.Top = 55+(i*15)
ChanLabel7.Top = 55+(i*15)
ChanLabel7.Bottom = 70+(i*15)
Case 8
ChanLabel8.Visible = 1
ChanAction8.Visible = 1
ChanLabel8.Text = CN(i+1)
ChanAction8.Top = 55+(i*15)
ChanLabel8.Top = 55+(i*15)
ChanLabel8.Bottom = 70+(i*15)
Case 9
ChanLabel9.Visible = 1
ChanAction9.Visible = 1
ChanLabel9.Text = CN(i+1)
ChanAction9.Top = 55+(i*15)
ChanLabel9.Top = 55+(i*15)
ChanLabel9.Bottom = 70+(i*15)
Case 10
ChanLabel10.Visible = 1
ChanAction10.Visible = 1
ChanLabel10.Text = CN(i+1)
ChanAction10.Top = 55+(i*15)
ChanLabel10.Top = 55+(i*15)
ChanLabel10.Bottom = 70+(i*15)
Case 11
ChanLabel11.Visible = 1
ChanAction11.Visible = 1
ChanLabel11.Text = CN(i+1)
ChanAction11.Top = 55+(i*15)
ChanLabel11.Top = 55+(i*15)
ChanLabel11.Bottom = 70+(i*15)
Case 12
ChanLabel12.Visible = 1
ChanAction12.Visible = 1
ChanLabel12.Text = CN(i+1)
ChanAction12.Top = 55+(i*15)
ChanLabel12.Top = 55+(i*15)
ChanLabel12.Bottom = 70+(i*15)
Case 13
ChanLabel13.Visible = 1
ChanAction13.Visible = 1
ChanLabel13.Text = CN(i+1)
ChanAction13.Top = 55+(i*15)
ChanLabel13.Top = 55+(i*15)
ChanLabel13.Bottom = 70+(i*15)
Case 14
ChanLabel14.Visible = 1
ChanAction14.Visible = 1
ChanLabel14.Text = CN(i+1)
ChanAction14.Top = 55+(i*15)
ChanLabel14.Top = 55+(i*15)
ChanLabel14.Bottom = 70+(i*15)
Case 15
ChanLabel15.Visible = 1
ChanAction15.Visible = 1
ChanLabel15.Text = CN(i+1)
ChanAction15.Top = 55+(i*15)
ChanLabel15.Top = 55+(i*15)
ChanLabel15.Bottom = 70+(i*15)
Case 16
ChanLabel16.Visible = 1
ChanAction16.Visible = 1
ChanLabel16.Text = CN(i+1)
ChanAction16.Top = 55+(i*15)
ChanLabel16.Top = 55+(i*15)
ChanLabel16.Bottom = 70+(i*15)
End Select
Next
End Sub
Why aren't the combo boxes changing position?
Regards, Simon.
03-09-2020 04:48 AM
To add a bit more information to this: I created a new dialogue box from scratch and just tried to alter its height during the EventInitialize event. There was no response.
The call from my DIAdem script is:
Option Explicit 'Forces the explicit declaration of all the variables in a script.
Dim SharedPath : SharedPath = "C:\Users\...\Trans\"
Call SUDDefLoad(SharedPath & "VBS\" & "NoName.sud")
Call SUDDlgShow("Dlg1")
And the code in the Dialogue Editor is:
Sub Dialog_EventInitialize(ByRef This) 'Created Event Handler
Dialog.Height = 160
End Sub
Anyone know what's happening?
Thanks.
03-09-2020 05:32 AM
Hi
What are you trying to do? Do you want to increase or decrease the size? In the help you will find a note that you could not change the height to a lower value than MinHeight. By default, MinHeight is the size at design time, but you can change it in the script. So if you want to reduce the dialog box, you should set MinHeight first.
Hope this helps
Winfried
03-09-2020 06:17 AM
Hi Winifred,
Thanks for the reply but I'm afraid that still doesn't work.
To summarise what I'm trying to do: I have a dialogue box that requests information from the user. There are 16 combo boxes that all sit in the same space. To the left of these dialogue boxes are a similar number of labels. During the initialization event a number of these dialogue boxes equal to the number of data channels in the open data file less one are repositioned downwards to form a column. Their respective labels are repositioned to sit alongside each box. You can see this in my first post. The dialogue box itself grows accordingly. As I said, this works fine in 2010 but has stopped working in 2019.
As a simpler test, I created a new dialogue box and just tried to alter its height. Hence my second post. The help files don't state that the MinHeight default is the design time size of the dialogue box, so that would be useful information to include. However, I shrunk the height of my dialogue box during design time to something quite small and then used Dialog.Height to increase its size to something considerably more. It didn't work.
What is more peculiar is that in my first post you can see that the dialogue box has increased in height to accomodate the column of labels. At that point my main problem was that the combo boxes weren't repositioning. Now, if I just trial the dialogue box height on its own I can't even get that to work.
Regards.
03-11-2020 09:29 AM
I have discovered a work-around to the combo box position problem, if not the reason for the problem in the first place. Whereas in the 2010 script I only needed to set the top position of each combo box, I know find that in 2019 if I set the top and bottom values then each box is placed correctly.
Simon.