[Done] Persistent entry and bold text

You need some new stunning features ? Tell us here.
Little John
Addict
Addict
Posts: 4812
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

[Done] Persistent entry and bold text

Post by Little John »

Hi,

after clicking in the main menu at "Form" > "New Form", it looks like this (PB 5.10 Beta 3 on Windows XP x86):

Image

The "<New Form>" tab contains a window, and the "Objects" tab contains the corresponding entry "Window_0". OK. :-)
But after closing the "<New Form>" tab, the "Objects" tab still contains the entry "Window_0". Shouldn't that entry disappear then?

Another question: Is it possible to change the font of the entries in the lower right corner, so that it is not bold? Sorry, but for me personally that doesn't look well.
The good thing is, it somewhat reminds me of Win 3.x, which makes me feel 20 years younger. :mrgreen:

Regards, Little John
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Persistent entry and bold text

Post by Polo »

It's not supposed to be bold, it seems there's issue with drawing text on the canvas on Windows XP, at least with some drawing mode (or I might be doing something wrong!), I'll try to grap a copy of XP and do some tests, thanks for letting me know!

About the Object list you're correct I'll try to fix that :)
Little John
Addict
Addict
Posts: 4812
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Persistent entry and bold text

Post by Little John »

Thanks!
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Persistent entry and bold text

Post by IdeasVacuum »

5.00 Beta 3, the text is not bold on XP, so something slightly changed between then and now.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Persistent entry and bold text

Post by Polo »

Object list is now cleaned when switching to different source or when closing form.
Little John
Addict
Addict
Posts: 4812
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Persistent entry and bold text

Post by Little John »

Hi!

(With 5.10 Beta 4, Text is still bold (on Windows XP).)

I forgot to mention the following:
If something is clipped off at the right side (like the bold text in the above picture), there should be a horizontal scroll bar. Otherwise it's hard to use.

Regards, Little John
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Persistent entry and bold text

Post by Polo »

This is unlikely to get changed, it's best to resize the panel. If i remember correctly it's the same in Visual Studio.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Persistent entry and bold text

Post by Polo »

Little John, can you try to reproduce this "bold font" problem with the canvas gadget? ie. by showing a specific code that will have the drawing font wrong on your system? Would help a lot :)
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Persistent entry and bold text

Post by Danilo »

Polo wrote:This is unlikely to get changed, it's best to resize the panel.
Is it possible to put it into a ScrollAreaGadget?
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Persistent entry and bold text

Post by Polo »

I need to think of the best way to handle that :)
Little John
Addict
Addict
Posts: 4812
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Persistent entry and bold text

Post by Little John »

Polo wrote:This is unlikely to get changed, it's best to resize the panel. If i remember correctly it's the same in Visual Studio.
I don't know Visual Studio. However, e.g. many editors have a tools panel at the (right) side, and most of the ones that I had learned to know show a scrollbar when the tools panel gets too small. So the user can decide her/himself what s/he wants to do in a given situation, depending on the screen size, the current DPI settings and window size, the content of the edit area ...
Even the PB IDE already has this functionality built in, try it with "Explorer" and "Templates" on the tools panel. :-)
Polo wrote:Little John, can you try to reproduce this "bold font" problem with the canvas gadget? ie. by showing a specific code that will have the drawing font wrong on your system? Would help a lot :)
Unfortunately, I don't have any experience with the canvas gadget. In particular, I don't know when a font is drawn as expected, and when it's drawn wrong. However, I've slightly changed the CanvasGadget example from the help, and here is my code and the output that it produces on my system (PB 5.10 Beta 4 on Windows XP SP3 x86). I hope it helps.

Code: Select all

If OpenWindow(0, 0, 0, 150, 150, "CanvasGadget") = 0
   MessageRequester("Error", "Can't open window.")
   End
EndIf

CanvasGadget(0, 10, 10, 130, 130)

;----------------------------------------
If StartDrawing(CanvasOutput(0))
   DrawText(10, 10, "Hello", 0, $FFFFFF)
   StopDrawing()
EndIf
;----------------------------------------
If LoadFont(1, "Arial", 10) = 0
   MessageRequester("Error", "Can't load font 1.")
EndIf
If StartDrawing(CanvasOutput(0))
   DrawingFont(FontID(1))
   DrawText(10, 30, "Hello", 0, $FFFFFF)
   StopDrawing()
EndIf
;----------------------------------------
If LoadFont(2, "Arial", 10, #PB_Font_Bold) = 0
   MessageRequester("Error", "Can't load font 2.")
EndIf
If StartDrawing(CanvasOutput(0))
   DrawingFont(FontID(2))
   DrawText(10, 50, "Hello", 0, $FFFFFF)
   StopDrawing()
EndIf
;----------------------------------------

Repeat
   Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Image
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Persistent entry and bold text

Post by Polo »

I think I know what the problem is, I use Segoe UI as the default font on Windows (Lucida Grande on other OSes), which I think Microsoft introduced with Vista (and is probably shipped with MS Office as well).
Can you check if you've got that font?
Little John
Addict
Addict
Posts: 4812
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Persistent entry and bold text

Post by Little John »

Polo wrote:I think I know what the problem is, I use Segoe UI as the default font on Windows (Lucida Grande on other OSes), which I think Microsoft introduced with Vista (and is probably shipped with MS Office as well).
Can you check if you've got that font?
Yes, that might be the cause of the problem. When I replace in my above code "Arial" with "Segoe UI", then all three lines are bold. You should not rely on the assumption, that everyone who uses the PB IDE (on Windows) has "Segoe UI" installed. As you wrote, it was introduced as the default dialog font with Vista.

At least for Windows, it would probably be the best not to use any fixed font at all, but to dynamically determine the dialog font of the current system, and then use that font:

Code: Select all

; Platform: WINDOWS

EnableExplicit

Structure FontInfo
   name.s
   size.l
   style.l
EndStructure

Procedure.i DialogFontInfo (*fi.FontInfo)
   ; -- Determine the dialog font of the system
   ; - Windows 95, 98  : MS Shell Dlg (= Microsoft Sans Serif) 8 pt
   ; - Windows 2000, XP: Tahoma 8 pt
   ; - Windows Vista, 7: Segoe UI 9 pt
   Protected ncm.NONCLIENTMETRICS
   Protected hDC.i
   
   ncm\cbSize = SizeOf(ncm)
   If SystemParametersInfo_(#SPI_GETNONCLIENTMETRICS, ncm\cbSize, @ncm, 0)
      *fi\name = PeekS(@ncm\lfMessageFont\lfFaceName)
      
      hDC = GetDC_(#Null)
      If hDC
         *fi\size = -MulDiv_(ncm\lfMessageFont\lfHeight, 72, GetDeviceCaps_(hDC, #LOGPIXELSY))
         If ncm\lfMessageFont\lfWeight = 700
            *fi\style = #PB_Font_Bold
         EndIf
         If ncm\lfMessageFont\lfItalic
            *fi\style + #PB_Font_Italic
         EndIf
         ReleaseDC_(#Null, hDC)
         ProcedureReturn 1       ; success
      EndIf
   EndIf
   
   ProcedureReturn 0             ; error
EndProcedure


Define DlgFont.FontInfo

If DialogFontInfo(@DlgFont)
   With DlgFont
      Debug \name
      Debug \size
      Debug \style
   EndWith
EndIf
Well, here are some people on the forum who know much more about fonts than me ... Maybe someone has additional or better suggestions.

Regards, Little John
Last edited by Little John on Sun Jan 20, 2013 2:05 am, edited 1 time in total.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Persistent entry and bold text

Post by ts-soft »

Please don't use it :wink:
This make a very big font on my 64-Bit System :mrgreen:
Change the structure to:

Code: Select all

Structure FontInfo
   name.s
   size.l
   style.l
EndStructure
Greetings - Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Little John
Addict
Addict
Posts: 4812
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Persistent entry and bold text

Post by Little John »

ts-soft wrote:This make a very big font on my 64-Bit System :mrgreen:
:D

Corrected in the above message.
Thank you!
Post Reply