mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If someone has a way of doing this, or a work around so that I can put the date & time into the title of my dialog with teh date & time being right justified, but the rest of the title being left justified, I'd appreciate hearing about it. I have looked through the posts on line, and did look at the spaces.dll, however, none of these options seems to work (with the exception of using $chr(160) which works with the font that I'm using, but doesn't guarantee that it'll work with someone else's font)

Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
if you notheme the dialog it might work

option dbu(or pixels) notheme

just a thought, i've found if i want dialogs to be exact I use pixels over dbus, especially if there are .bmp being displayed in it.

btk


billythekid
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Nice idea, sorry to say that it didn't work.

Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
lol oh well, ok how about, titleless dialog with a bmp top designed how you want the titlebar to look, then a hidden @window of the exact dimensions(pixels) as the titlebar.

drawtext the info you want to the window, drawsave @window temp.bmp, did -g dialog temp.bmp, remove temp.bmp

???

oh, can you even get a dialog with no titlebar??

btk ;o)


billythekid
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If I was to go to all that trouble, it sound like it'd be easier to just use the $chr(160) and put a warning in the dialog that the display is designed for a particular font.

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
I played around with your idea to pad with 160 and it seems to work fine
the only thing is the point you had about the users font.
Code:
alias datetime { return $asctime(dddd mmmm) $ord($asctime(d)) $asctime(H:nn TT) }
alias leftfill {
  var %filllen = 50 - $len($datetime)
  return $str( ,%filllen) $+ $datetime
}

alias testdialog dialog -m datetime datetime
dialog datetime {
  title Testing $leftfill
  size -1 -1 400 100
  option pixel
}

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I think I found a way to determine if $chr(160) is a blank character or not. If 160 is blank, you could use it as a padding character in the title. And iff 160 is NOT blank, you could use some alternate title format (a hyphen for example). Here is the code I made:

Code:
;Usage: $isblank
;Returns: 1 if $chr(160) is blank
;Returns: 0 if $chr(160) is NOT blank
alias isblank {
  if ($window(@chr)) window -c @chr
  window -hp +d @chr 0 0 25 25
  drawrect -f @chr 0 1 0 0 25 25
  drawtext @chr 1 1 1 $chr(160)

  var %x = 0, %y = 0
  while (%y < 20) {
    inc %y
    %x = 0
    while (%x < 20) {
      inc %x
      if ($getdot(@chr,%x,%y) == $color(1)) {
        window -c @chr
        return 0
      }
    }
  }
  window -c @chr
  return 1
}


-genius_at_work

Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
should work in most cases unless the font is insanely big (Think "A" and the @chr window only captures the upperright corner of the real square A is printed in.) or color 0 and 1 are equal so its better to use the rgb values.


$maybe
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
This is faster and covers a bigger image (100x100)

Code:
; Usage $isblank(N) where N represents asc value of character
; returns $null for out of range N values
; returns $false if not blank
; returns $true if is blank
;
alias isblank {
  tokenize 32 $int($1)
  if ($1 isnum 1-255) {
    if ($1 == 32) { return $true }
    window -c @chr
    window -hp +d @chr 0 0 100 100
    drawrect -fr @chr 0 1 0 0 100 100
    drawtext -r @chr 16777215 0 0 $chr($1)
    drawsave @chr chr.bmp
    window -c @chr
    var %return = $iif($crc(chr.bmp) == 2D3AC394,$true,$false)
    .remove chr.bmp
    return %return
  }
}



* 2D3AC394 is the $crc of a blank chr.bmp

* i defaulted to 32 being blank at all times even if the font doesnt show it as blank, basicly becuase we cant send multiple of them anyway frown and i also cant drawtext $chr(32) lol

* made it to take a passed asc value, so it can be used to scan for a blank character


Link Copied to Clipboard