March 28, 2024, 04:37:47 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Font in Messagebox

Started by billhsln, June 28, 2020, 02:59:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

Is there a way to set a font for a MessageBox?  I would like to have the message aligned using a fixed pitch font, tried SETFONT main,"Courier New",12,400,0.  With a messagebox:

answer = MESSAGEBOX main,"   Yes   -Delete&Add again,\n   No    -Do nothing,\n   Cancel-Delete","Option",@MB_YESNOCANCEL|@MB_ICONQUESTION

Quoteanswer = MESSAGEBOX main,"   Yes   -Delete&Add again,\n   No    -Do nothing,\n   Cancel-Delete","Option",@MB_YESNOCANCEL|@MB_ICONQUESTION

Thanks,
Bill
When all else fails, get a bigger hammer.

Andy

Bill,

This could be interesting to you.

https://www.tenforums.com/tutorials/77571-change-message-boxes-text-size-windows-10-a.html

Tried it on my Win 7 PC and it works (used the registry changes - option 2).

The only fly in this is you have to log out then log back in to windows for the changes to work, and they are system wide i.e. not just for a program you are writing.

I use my on windows for messages boxes.

sub WindowDelete(int Switch)

OPENWINDOW w12,0,0,470,200,@MINBOX|@MAXBOX|@TOPMOST|@CAPTION,0,"Please confirm",&DeleteHandler
uint Theme = 0
if !CloseDown
Theme = ScreenColour
else
Theme = BackColour
endif

Setwindowcolor w12,Theme

CONTROL w12,@STATIC,"",0,25,470,25,@CTEDITCENTER|0x200,1
SETFONT w12,"Arial",12,500,0,1
SETCONTROLCOLOR w12,1,RGB(0,0,0),Theme

CONTROL w12,@STATIC,"",0,60,470,25,@CTEDITCENTER|0x200,2
SETFONT w12,"Arial",12,500,0,2
SETCONTROLCOLOR w12,2,RGB(0,0,0),Theme

if CloseDown
setcontroltext(w12,1,"Do you want to save the changes for")
setcontroltext(w12,2,RealTabName)
endif

if Switch = 2
setcontroltext(w12,1,"Are you sure you want to delete the subroutine")
setcontroltext(w12,2,getstring(w1,Combo2,getselected(w1,Combo2)) + "?")   
endif

if Switch = 4
setcontroltext(w12,1,"Are you sure you want to delete the window")
setcontroltext(w12,2,getstring(w1,Combo4,getselected(w1,Combo4)) + "?")   
endif

CONTROL w12,@BUTTON,"Yes",140,110,80,25,0,4
SETFONT w12,"Arial",12,500,0,4
SETCONTROLCOLOR w12,4,RGB(0,0,0),Theme

CONTROL w12,@BUTTON,"No",240,110,80,25,0,8
SETFONT w12,"Arial",12,500,0,8
SETCONTROLCOLOR w12,8,RGB(0,0,0),Theme

if CloseDown > 0
setfocus w12,4
else
setfocus w12,8
endif

WAITUNTIL IsWindowClosed(w12)

return
endsub

SUB DeleteHandler(),INT
SELECT @MESSAGE
CASE @IDCREATE
  CENTERWINDOW w12

CASE @IDCLOSEWINDOW
  DelConfirm = 0
  CLOSEWINDOW w12

case @IDKEYDOWN
  if @CODE = 37
  setfocus w12,4
  endif
  if @CODE = 39
  setfocus w12,8
  endif   

CASE @IDCONTROL
  SELECT @CONTROLID
case 4 'Yes
  if @NOTIFYCODE = 0
  DelConfirm = 1
  closewindow w12
  endif

case 8 'No
  if @NOTIFYCODE = 0
  DelConfirm = 0
  closewindow w12
  endif

  ENDSELECT
    ENDSELECT
RETURN 0
ENDSUB

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

billhsln

I will have to read over this code a few times.  At first glance, it boggles the mind.

Bill
When all else fails, get a bigger hammer.

fasecero

As far as I know, MessageBox uses the default system font. In theory, and I mean in theory, you could change the font with a window hook (SetWindowsHookEx), but if it's possible, it would be real hard to achieve. The best way, like Andy suggest, is just to make your own messagebox with a dialog.