[PB5.70] SetGadgetFont triggers EventType() in EditorGadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
marcoagpinto
Addict
Addict
Posts: 945
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

[PB5.70] SetGadgetFont triggers EventType() in EditorGadget

Post by marcoagpinto »

Hello!

I believe I have found a bug, but this time, instead of reporting it as a bug I am posting in this forum first so that everyone can check:

Code: Select all

Enumeration
  #WINDOW
  #EDITORGADGET
EndEnumeration

OpenWindow(#WINDOW,0,0,640,480,"Test")

t=LoadFont(1,"Arial",10,#PB_Font_HighQuality)
If t=#False : MessageRequester("Error", "Can't load Arial font.",#PB_MessageRequester_Error) : EndIf
SetGadgetFont(#PB_Default,FontID(1))

EditorGadget(#EDITORGADGET,10,10,600,400)


t=LoadFont(1000,"Arial",20,#PB_Font_HighQuality)
If t=#False : MessageRequester("Error", "Can't load Arial font.",#PB_MessageRequester_Error) : EndIf
SetGadgetFont(#EDITORGADGET,FontID(1000))

quit=#False
Repeat
  
    event=WaitWindowEvent()
    event_menu=EventMenu()
    event_gadget=EventGadget()
    event_type=EventType()
    
    If event_gadget=#EDITORGADGET And event_type=#PB_EventType_Change
      Debug "EditorGadget changed!"
    EndIf
    
    If event=#PB_Event_CloseWindow
      quit=#True
    EndIf
    
Until quit=#True
  
  
  

The:

Code: Select all

SetGadgetFont(#EDITORGADGET,FontID(1000))
Triggers an event saying that the EditorGadget has been changed, which is not true as I only changed its font.

Could someone verify if it is a bug?

I tested it with PureBasic 5.70 x64.

Thank you!
acreis
Enthusiast
Enthusiast
Posts: 182
Joined: Fri Jun 01, 2012 12:20 am

Re: [PB5.70] SetGadgetFont triggers EventType() in EditorGad

Post by acreis »

I think it's not a Bug. One could wish do something when font changes.

Microsoft states:

EN_UPDATE notification code Sent when an edit control is about to redraw itself. This notification code is sent after the control has formatted the text, but before it displays the text. This makes it possible to resize the edit control window, if necessary.
Post Reply