Color in DateGadget do not Work

Found an issue in the documentation ? Please report it here !

Moderator: Documentation Editors

Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Color in DateGadget do not Work

Post by Cyllceaux »

Code: Select all

OpenWindow(0,100,100,100,100,"Test")
DateGadget(1,0,0,100,22,"%dd.%mm.%yyyy",Date(),#PB_Date_CheckBox)
SetGadgetColor(1,#PB_Gadget_BackColor,#Red)
SetGadgetColor(1,#PB_Gadget_FrontColor,#Red)

Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
Both color do not work. The Textfield AND the Calendar are still white
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Color in DateGadget do not Work

Post by RSBasic »

Code: Select all

EnableExplicit

Procedure WindowCallback(hWnd, uMsg, wParam, lParam)
  Protected *NMDATETIMECHANGE.NMDATETIMECHANGE
  
  Select uMsg
    Case #WM_NOTIFY
      *NMDATETIMECHANGE = lParam
      
      Select *NMDATETIMECHANGE\nmhdr\hwndfrom
        Case GadgetID(0)
          If *NMDATETIMECHANGE\nmhdr\code = #DTN_DROPDOWN
            SetWindowTheme_(FindWindowEx_(FindWindow_("DropDown", 0), #Null, "SysMonthCal32", #Null), @"", @"")
          EndIf
      EndSelect
      
  EndSelect
  
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  DateGadget(0, 15, 50, 200, 17, "%dd/%mm/%yyyy", Date())
  SetGadgetColor(0, #PB_Gadget_BackColor, #Red)
  SetGadgetColor(0, #PB_Gadget_FrontColor, #Red)
  
  SetWindowCallback(@WindowCallback())
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
EndIf
Image
Image
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Color in DateGadget do not Work

Post by Dude »

Oops, thought you wrote CalendarGadget(). My bad. :oops:
Last edited by Dude on Sun Mar 11, 2018 1:04 pm, edited 1 time in total.
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: Color in DateGadget do not Work

Post by Cyllceaux »

Which manual?

http://www.purebasic.com/documentation/ ... adget.html nope
https://www.purebasic.com/german/docume ... adget.html nope
This gadget supports the SetGadgetColor() and GetGadgetColor() functions with the following values as 'ColorType' to color the dropdown calendar (the edit area cannot be colored)
I mean the dropdown calendar
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: Color in DateGadget do not Work

Post by RASHAD »

It looks like wrong information in the manual
For Windows

Code: Select all

OpenWindow(0, 0,0,400,300, "", #PB_Window_SystemMenu| #PB_Window_ScreenCentered)
DateGadget(0, 10, 90, 100, 25,"%mm/%dd/%yyyy")
SetGadgetColor(0,#PB_Gadget_FrontColor , #Red)
SetGadgetColor(0, #PB_Gadget_BackColor,RGB(255,255,128))
StringGadget(1, 10, 10, 100, 25, "")
SetGadgetColor(1, #PB_Gadget_BackColor,RGB(255,255,128))
StringGadget(2, 10, 50, 100, 25, "")
SetGadgetColor(2, #PB_Gadget_BackColor,RGB(255,255,128))

ButtonGadget(3,10,265,60,25,"TEST")
SetThemeAppProperties_(1)

Repeat    
  Select WaitWindowEvent()
  Case #PB_Event_CloseWindow
    Quit = 1

  Case #PB_Event_Gadget
    Select EventGadget()
      Case 0
        
    EndSelect
  EndSelect

Until Quit = 1
Egypt my love
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Color in DateGadget do not Work

Post by Fred »

https://learn.microsoft.com/en-us/windo ... setmccolor when Visual Styles are enable, coloring doesn't work anymore.
I tried to remove the theme only for the dropdown window, but it creates other issue (size isn't good anymore). So it's more a Windows change here

Code: Select all

    if (((LPNMHDR)lParam)->code == DTN_DROPDOWN)
    {
      if (MonthCalWindow = (HWND)SendMessage(((LPNMHDR)lParam)->hwndFrom, DTM_GETMONTHCAL, 0, 0))
      {
         SetWindowTheme(MonthCalWindow, L"", L"");
      }
    }
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Color in DateGadget do not Work

Post by Andre »

Any suggestion for a new remark for DateGadget() docs?
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply