mIRC Home    About    Download    Register    News    Help

Topic Options
#152886 - 08/07/06 12:55 AM Preserving multiple spaces for a dialog title
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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)

Top
#152887 - 08/07/06 01:00 AM Re: Preserving multiple spaces for a dialog title
billythekid Offline
Fjord artisan

Registered: 01/03/03
Posts: 612
Loc: Aberdeen, Scotland
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

Top
#152888 - 08/07/06 01:12 AM Re: Preserving multiple spaces for a dialog title
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Nice idea, sorry to say that it didn't work.

Top
#152889 - 08/07/06 01:21 AM Re: Preserving multiple spaces for a dialog title
billythekid Offline
Fjord artisan

Registered: 01/03/03
Posts: 612
Loc: Aberdeen, Scotland
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

Top
#152890 - 08/07/06 01:34 AM Re: Preserving multiple spaces for a dialog title
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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.

Top
#152891 - 08/07/06 02:02 AM Re: Preserving multiple spaces for a dialog title
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
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
}

Top
#152892 - 08/07/06 02:32 AM Re: Preserving multiple spaces for a dialog title
genius_at_work Offline
Hoopy frood

Registered: 08/10/05
Posts: 1741
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

Top
#152893 - 08/07/06 01:02 PM Re: Preserving multiple spaces for a dialog title
Mpdreamz Offline
Hoopy frood

Registered: 27/04/04
Posts: 759
Loc: Arnhem, The Netherlands
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

Top
#152894 - 08/07/06 10:44 PM Re: Preserving multiple spaces for a dialog title
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
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

Top