mIRC Homepage
Posted By: RusselB Dialog drop down list is too long. - 27/06/06 11:36 PM
Can anyone explain why the drop down box referenced by $did(2) is a lot longer than the one in $did(4)? It looks like the box is a minimum of 8 times the size that it needs to be.

Here's the layout for the dialog:
Code:
 dialog Observer {
  title "Observer"
  size -1 -1 665 215
  option pixels
  text "Account", 1, 5 5 120 16, center
  combo 2, 5 21 120 100, edit drop
  text "Route", 3, 125 5 60 16, center
  combo 4, 125 21 60 100, edit drop
  text "Name", 5, 190 6 50 16
  edit "", 6, 240 5 285 20
  text "Address", 7, 190 27 50 16
  edit "", 8, 240 25 230 20
  text "Apt", 9, 475 27 20 16
  edit "", 10, 495 25 45 20, right
  text "Phone", 11, 545 6 30 16
  edit "", 12, 575 5 85 20
  text "Special Directions", 13, 190 45 50 40, center
  edit "", 14, 240 45 420 40, multi
  box "Deliveries", 15, 5 120 70 90
  check "Daily", 16, 7 134 50 16
  check "MP/LL", 17, 7 150 50 16
  check "Sat. Only", 18, 7 166 65 16
  check "Vacation", 19, 7 182 65 16
  box "Billing", 20, 73 120 60 90
  radio "PIO", 21, 75 134 40 16, group
  radio "CMP", 22, 75 150 40 16
  radio "Mthly", 23, 75 166 45 16
  radio "Bi-Wkly", 24, 75 182 55 16
  text "Start", 25, 190 125 100 15, center
  list 26, 190 140 100 70, size
  text "Stop", 27, 290 125 100 15, center
  list 28, 290 140 100 70, size
  text "Deliveries", 29, 390 125 55 15, center
  list 30, 390 140 55 70, size
  text "Billing", 31, 445 125 50 15, center
  list 32, 445 140 50 70, size
  text "Payment Amount && Date", 33, 495 125 150 15, center
  list 34, 495 140 50 70, size
  list 35, 545 140 100 70, size
  edit "", 37, 495 105 50 20
  text "Balance", 38, 545 106 50 16, center
  edit "", 39, 595 105 50 20, read
  button "OK", 40, 135 125 50 18, ok
  button "Save", 41, 135 145 50 18
  button "Apply", 42, 135 165 50 18, default
  text "Paid To", 43, 190 90 100 16, center
  edit "", 44, 190 105 100 20, right
  text "Expiry", 45, 290 90 100 16, center
  edit "", 46, 290 105 100 20, read right
  button "Cancel", 36, 135 185 50 18, cancel
  text "Postal Code", 47, 545 27 60 16
  edit "", 48, 605 24 55 21
}
 
Posted By: hmtX Re: Dialog drop down list is too long. - 28/06/06 12:01 AM
both drop down lists have the same length for me.
Posted By: RusselB Re: Dialog drop down list is too long. - 28/06/06 12:14 AM
Thanks. If that's the case, then something is happening to the length of the drop down list when I add items to the list (or at least that's what I'm thinking would be the problem).

here's the section of the dialog that loads the information into those two id's
Code:
 on *:dialog:Observer:init:*:{
  if !$hget(Observer) { .hmake Observer 100 }
  if $exists(Observer.hsh) { .hload Observer Observer.hsh }
  var %a = 1, %b = $hget(Observer,0).item
  while %a <= %b {
    set %rtes $addtok(%rtes,$gettok($hget(Observer,%a),1,44),32)
    inc %a
  }
  did -r $dname 4
  didtok $dname 4 32 %rtes
  did -bh $dname 40
}
on *:dialog:Observer:sclick:4:{
  set %rte $did(4).seltext
  did -r $dname 2,6,12,8,10,48,14,44,46,37,39,26,28,30,32,34,35
  did -u $dname 16,17,18,19,21,22,23,24
  var %a = 1, %b = $hget(Observer,0).item
  while %a <= %b {
    var %sub = $hfind(Observer,$+(%rte,*),%a,w).data
    did -a $dname 2 %sub
    inc %a
  }
}
 


A couple of examples of the data stored in the hash table are:
Quote:
49070325 33,161,Nelson,801,J. McNally,O, ,06/28/2006,D
49055125 446,371,Brock S, ,Cooper Elizabeth,O, ,11/04/2006,D


The 8 digit number at the beginning is the hash table item, the rest of the information is the data comma separated

There's a total of 276 items currently in the hash table
RusselB, are you talking about Length-wise, or height-wise?
this is what the dialog looks like for me:
Posted By: RusselB Re: Dialog drop down list is too long. - 28/06/06 12:18 AM
Top to bottom, not left to right.
Can you post a picture of the problem you are having?

-genius_at_work
Posted By: RusselB Re: Dialog drop down list is too long. - 28/06/06 03:56 AM
Yeah..I think this should do the trick..should've thought about posting it earlier.


As you can see, the box for the dialog is a lot longer than what is required for the data to show.
I noticed you are using a loop and /didtok to load the combo box. As a test, maybe try putting a regular /did command in the loop and forgetting about the /didtok.

You could try to determine exactly how many extra spaces there are (ie 6 extra spaces for every proper line). As for a cause, I can't see anything in that code that could be causing the extra spaces.

-genius_at_work
Posted By: RusselB Re: Dialog drop down list is too long. - 28/06/06 04:46 AM
Wrong part of the code. This dialog box is referenced as ID 2 (Account), which does use a loop, but not the didtok.
The didtok line is used to fill ID 4 (Route)
Posted By: MikeChat Re: Dialog drop down list is too long. - 28/06/06 05:47 AM
one other thing, not sure if you intended it if you remove the drop style on the combo, then your size of 100 fits ID 2 and 4 veritcally in that clear space
Posted By: RusselB Re: Dialog drop down list is too long. - 28/06/06 06:44 AM
Thank you for noticing that. I don't think it was intentional, however, I've been working on this in spurts for the past couple of months (after loosing one that was complete due to a hard drive crash), and sometimes when I'm more awake than others. That effectively solves the problem I was having (although it was purely a problem with the visual appearance rather than how the dialog actually works).

I'd still be interested in knowing if someone could explain why the drop down list was allocating so much space. Based on some rough calculations, it almost looks like it was allowing space to accomodate an entry for each item in the hash table.
Posted By: Mpdreamz Re: Dialog drop down list is too long. - 28/06/06 03:32 PM
Quote:

Based on some rough calculations, it almost looks like it was allowing space to accomodate an entry for each item in the hash table.

Isn't that what looping from 1 to $hget(Observer,0).item would do ?
Code:
var %a = 1, %b = $hget(Observer,0).item
  while %a <= %b {
    var %sub = $hfind(Observer,$+(%rte,*),%a,w).data
    did -a $dname 2 %sub


if %sub = $null it will still add null to the list as an item.
Posted By: RusselB Re: Dialog drop down list is too long. - 28/06/06 08:29 PM
Bingo...that was the problem. Easily countered by checking if %sub == $null before adding to the list.

Thanks to all who worked on this problem.
© mIRC Discussion Forums