Author Topic: DateTime control  (Read 2671 times)

Leroy Hindman

  • Newbie
  • *
  • Posts: 3
    • View Profile
DateTime control
« on: August 25, 2022, 02:44:47 pm »
Dear Chriss

I am using a DateTime control on a dialog and would like to color it.  I can color the calendar that opens up by using EZ_SetColor but it does nothing to the bar where the date goes, can this part of the controls color be set and if so what must I do to set it.

Thank You
Leroy Hindman

Leroy Hindman

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: DateTime control
« Reply #1 on: August 26, 2022, 10:02:02 am »
If anyone know how to do this reply to me it doesn't have to be Chriss himself that answers.  I am sorry I didn't word this better and ask for everyone's help.  I would appreciate any help at all and thank you ahead.

Chris Boss

  • Administrator
  • Jr. Member
  • *****
  • Posts: 60
    • View Profile
Re: DateTime control
« Reply #2 on: August 26, 2022, 09:32:07 pm »
The Visual Designer does not allow you to select colors for the Date Time control.

The reason I made it that way is likely because the control does not support defining colors.

You can select the option:  "Allow %EZ_Loading Event"

and the control will get the %EZ_Loading event just before EZGUI creates the control.

You can define different colors in this event using EZ_Color, but if it does not chnage color it is because Windows Themes does not allow the control to use colors.

This may though call EZ_DefCalendarExColors in this event to set the colors for the Calendar part of the DateTime control.

EZ_SetAttr (attributes:  BColor and TColor) can be called at any time but again I believe it only sets the colors for the drop down calendar part of the DateTime control.



 

Leroy Hindman

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: DateTime control
« Reply #3 on: August 27, 2022, 08:20:35 am »
Chris I couldn't get even the calendar to change under the EZ_Loading event but it does change the calendar only under the EZ_Loaded event.  The EZ_DefCalendarExColors doesn't work under the EZ_Loading event either.  I know the definition of EZ_SetColor says the control has to be created before it can have the color set.  I never did get the bar where the date displays to change colors.

Chris Boss

  • Administrator
  • Jr. Member
  • *****
  • Posts: 60
    • View Profile
Re: DateTime control
« Reply #4 on: August 27, 2022, 11:49:44 am »
The %EZ_Loading event occurs just "before" the control is created, so you can't use any commands which expect the control to exist in this event.

EZ_DefCalendarExColors

will fail in %EZ_Loading because the control does not exist yet.

The event %EZ_Loaded (ends in ed rather than ing) occurs right after the control is created, but before it is visible, so you can make calls to commands
which expect the control to exist in this event.

EZ_DefCalendarExColors should work fine in the %EZ_Loaded event !

Any command which has parameters for the form name and control ID, must be called only after the control is created and exists.

%EZ_Loading serves the purpose of changing control creation parameters for a control before it is created and for calls to EZGUI commands which have to be called before a control is create (ie. EZ_Color, EZ_UseFont).

Internally in all control creation commands it works this way:

{Control Creation Command}
  • Generate %EZ_Loading event if flagged to do so by a previous EZ_AllowLoadingEvent command
  • Modify any control creation parameters if changing in %EZ_Loading event using EZ_SetLoadStr or EZ_SetLoadVal commands
  • Create Control
  • Generate %EZ_Loaded event

By understand the sequence EZGUI uses when creating controls you will know what you can do in each of the events, %EZ_Loading and %EZ_Loaded

Forms work the same way, but also have a third event called:

%EZ_Started

which occurs after the form is created, all the controls are created and the form is now visible




« Last Edit: August 27, 2022, 11:56:22 am by Chris Boss »