mIRC Home    About    Download    Register    News    Help

Print Thread
#156874 20/08/06 09:31 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Hi,
I would like to make some sort of table in mIRC, I think the best way would be to make it with a dialog, but I never made one before.

Could anyone please look at the below specification, and see if they know a way to make that?

Basicly, I want to right click a channel, choose "Hour grid" and get grid a like MS Excel.
It should contain 3 columns, and like 24 rows.

The first column would be filled in automaticly with hours, cell A1 would be the current hour (local time), then cell A2 would be +1 hour, A3 +2 hours etc.

The second column would start with a number that I specify in a text box on the form.
So, B1 would be 1050 (specified by me)
Then automaticly B2 would be 1051, B3 would be 1052 etc.

The third column should be a free text box, that I can enter custom information in.

The contents of the table or dialog doesn't have to be stored, the content can be removed when the dialog is closed.

It would be nice to be able to copy the content of the grid to the clipboard though.

Is this possible?
Would anyone wanna give this a try?

Thx in advance!

#156875 20/08/06 09:53 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
mIRC doesn't have a grid control so you're either going to have to use 72 editboxes or a third party dll that has a listview/grid control.

#156876 20/08/06 10:27 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Hmm, that aint good frown

And what if we limit it to 12 rows?
It would be 36 boxes, could that work?

Could you make give me a example for the first 3 rows or summin? I'm sure I would be able to copy and paste it to make it 12 rows...

#156877 20/08/06 10:36 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Wuthout getting fancy, here is a really hacked version of what you want (to the best of my understanding. Put the number in the top middle column, and the rest will populate. From there, fill in the third column with the desired values, and viola.

Code:
alias hour_grid {
  var %dlg = hour_grid
  /dialog $iif($dialog(%dlg),-vie,-md) %dlg %dlg
}

dialog hour_grid {
  title "Hour Grid"
  size -1 -1 100 245
  option dbu

  box "", 999, 0 0 100 245

  edit "", 1, 5 10 30 10, disabled center
  edit "", 2, 5 19 30 10, disabled center
  edit "", 3, 5 28 30 10, disabled center
  edit "", 4, 5 37 30 10, disabled center
  edit "", 5, 5 46 30 10, disabled center
  edit "", 6, 5 55 30 10, disabled center
  edit "", 7, 5 64 30 10, disabled center
  edit "", 8, 5 73 30 10, disabled center
  edit "", 9, 5 82 30 10, disabled center
  edit "", 10, 5 91 30 10, disabled center
  edit "", 11, 5 100 30 10, disabled center
  edit "", 12, 5 109 30 10, disabled center
  edit "", 13, 5 118 30 10, disabled center
  edit "", 14, 5 127 30 10, disabled center
  edit "", 15, 5 136 30 10, disabled center
  edit "", 16, 5 145 30 10, disabled center
  edit "", 17, 5 154 30 10, disabled center
  edit "", 18, 5 163 30 10, disabled center
  edit "", 19, 5 172 30 10, disabled center
  edit "", 20, 5 181 30 10, disabled center
  edit "", 21, 5 190 30 10, disabled center
  edit "", 22, 5 199 30 10, disabled center
  edit "", 23, 5 208 30 10, disabled center
  edit "", 24, 5 217 30 10, disabled center

  edit "", 25, 34 10 30 10, center
  edit "", 26, 34 19 30 10, disabled center
  edit "", 27, 34 28 30 10, disabled center
  edit "", 28, 34 37 30 10, disabled center
  edit "", 29, 34 46 30 10, disabled center
  edit "", 30, 34 55 30 10, disabled center
  edit "", 31, 34 64 30 10, disabled center
  edit "", 32, 34 73 30 10, disabled center
  edit "", 33, 34 82 30 10, disabled center
  edit "", 34, 34 91 30 10, disabled center
  edit "", 35, 34 100 30 10, disabled center
  edit "", 36, 34 109 30 10, disabled center
  edit "", 37, 34 118 30 10, disabled center
  edit "", 38, 34 127 30 10, disabled center
  edit "", 39, 34 136 30 10, disabled center
  edit "", 40, 34 145 30 10, disabled center
  edit "", 41, 34 154 30 10, disabled center
  edit "", 42, 34 163 30 10, disabled center
  edit "", 43, 34 172 30 10, disabled center
  edit "", 44, 34 181 30 10, disabled center
  edit "", 45, 34 190 30 10, disabled center
  edit "", 46, 34 199 30 10, disabled center
  edit "", 47, 34 208 30 10, disabled center
  edit "", 48, 34 217 30 10, disabled center

  edit "", 49, 63 10 30 10, center
  edit "", 50, 63 19 30 10, center
  edit "", 51, 63 28 30 10, center
  edit "", 52, 63 37 30 10, center
  edit "", 53, 63 46 30 10, center
  edit "", 54, 63 55 30 10, center
  edit "", 55, 63 64 30 10, center
  edit "", 56, 63 73 30 10, center
  edit "", 57, 63 82 30 10, center
  edit "", 58, 63 91 30 10, center
  edit "", 59, 63 100 30 10, center
  edit "", 60, 63 109 30 10, center
  edit "", 61, 63 118 30 10, center
  edit "", 62, 63 127 30 10, center
  edit "", 63, 63 136 30 10, center
  edit "", 64, 63 145 30 10, center
  edit "", 65, 63 154 30 10, center
  edit "", 66, 63 163 30 10, center
  edit "", 67, 63 172 30 10, center
  edit "", 68, 63 181 30 10, center
  edit "", 69, 63 190 30 10, center
  edit "", 70, 63 199 30 10, center
  edit "", 71, 63 208 30 10, center
  edit "", 72, 63 217 30 10, center

  button "Copy To Clipboard", 100, 4 230 90 12
}

on *:DIALOG:hour_grid:INIT:*: {
  var %h = 1
  while (%h < 25) {
    /did -ra $dname %h %h
    /inc %h
  }
}

on *:DIALOG:hour_grid:SCLICK:*: {
  if ($did == 100) {
    var %l = 1, %space = $chr(9)
    while (%l < 25) {
      var %col1 = %l, %col2 = %l + 24, %col3 = %l + 48
      /clipboard $iif(%l == 1,-n,-an) $+($did(%col1).text,%space,$did(%col2).text,%space,$did(%col3).text)
      /inc %l
    }
  }
}

on *:DIALOG:hour_grid:EDIT:*: {
  if ($did == 25) {
    var %e = 26, %num = $did($did).text + 1
    if (%num isnum) {
      while (%e < 49) {
        /did -ra $dname %e %num
        /inc %e
        /inc %num
      }
    }
  }
}




turns in to:

Code:
1	1050	767
2	1051	6546
3	1052	216
4	1053	216
5	1054	0
6	1055	622
7	1056	061
8	1057	26
9	1058	2161
10	1059	21
11	1060	61
12	1061	65157
13	1062	34
14	1063	651
15	1064	54
16	1065	19654
17	1066	1695
18	1067	6
19	1068	9165
20	1069	461
21	1070	64
22	1071	3168
23	1072	1
24	1073	96


-KingTomato
#156878 20/08/06 10:47 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
OMG!

Dude, you do rule grin
Thank you once again KingTomato

#156879 20/08/06 10:50 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You have more patience than I do :tongue:

#156880 20/08/06 10:56 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
You're kidding?

Code:
alias writedcode {
  /clear -s
  var %d = 0, %did = 49, %lid = 72, %startx = 63, %starty = 10, %height = 9
  while (%did <= %lid) {
    /echo -s edit "", %did $+ , %startx $calc(%starty + (%d * %height)) 30 10, center
    /inc %did
    /inc %d
  }
}


Just changed startx, did, and added "disabled" to the /echo on the first two columns. wink


-KingTomato
#156881 20/08/06 11:17 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I thought you might've used a script after I considered how long it'd take to make the table by coding it or using dstudio or something.

#156882 20/08/06 11:25 PM
Joined: May 2006
Posts: 93
Babel fish
Offline
Babel fish
Joined: May 2006
Posts: 93
in this cases i usually use a list for every column...

#156883 21/08/06 10:07 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
I just encoutered one small problem frown

The first column currently counts from 1 to 24.
But I need it to count from the current hour to the current hour plus 24.

For example, in my timezone its now 21:15.
The first column should look like this:
21:00
22:00
23:00
00:00
01:00
02:00
03:00
etc.
etc.

I tried modifying the original code, but it didnt work out very well.
Because $calc($date(HH) + 24) would return 45 in the above example...

Code:
on *:DIALOG:hour_grid:INIT:*: {
  var %boxname = 1
  var %starting-hour = $date(HH)
  var %ending-hour = $calc($date(HH) + 24)
  while (%starting-hour < %ending-hour) {
    did -ra $dname %boxname %starting-hour
    inc %boxname
    inc %starting-hour
  }
}


Can anyone tell me how to get that part working?
Thx in advance.

#156884 22/08/06 05:12 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Code:
on *:DIALOG:hour_grid:INIT:*: {
  var %d = 1, %h = 20, %e = %h + 24
  while (%h < %e) {
    /did -ra $dname %d $base(%h,10,10,2) $+ :00
    /inc %h
    /inc %d
    if (%h > 23) var %e = %e - 24, %h = 0
  }
}


-KingTomato
#156885 22/08/06 05:33 AM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Almost King.
I changed %h = 24 to %h = $date(HH)
And now its perfect!

Thx!

#156886 22/08/06 02:51 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I coded it at 12:30, so i needed a way to test it. Oops! wink


-KingTomato

Link Copied to Clipboard