Dialog Timer Display

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Dialog Timer Display

Post by PepsiHog » Sun Feb 20, 2011 2:33 am

v12

Hi, Everyone.

I have a question. Why will this not work?

Code: Select all

let>asw=0

Repeat>asw
add>asw,1
setdialogproperty>Dialog1,Edit3,Caption,%asw%
wait>1
Until>asw=15

Code: Select all


Isn't the dialog suppose to be dynamic?  Or does this change the dynamics?  :lol:  (little humor)

I need to display a working count down timer in a dialog.  I can't get it. Any suggestions?  Ideas?  (I know this would count up....don't SetFocus> there)

Please.

Thanks.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sun Feb 20, 2011 3:54 am

Why will this not work?
That is my favorite question. I must ask it 20 times a day.

There's nothing obvious that is wrong with the code you posted so there must be an unposted issue. Can you post the rest of the code?

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

code

Post by PepsiHog » Sun Feb 20, 2011 6:03 am

Code: Select all

Dialog>Dialog7
object Dialog7: TForm
  Left = 590
  Top = 266
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  BorderStyle = bsSingle
  Caption = 'Eagle Eye - Login'
  ClientHeight = 221
  ClientWidth = 439
  Color = clBlack
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  FormStyle = fsMDIForm
  Icon.Data = {


  OldCreateOrder = True
  Position = poDesktopCenter
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object MSImage1: tMSImage
    Left = -8
    Top = 0
    Width = 225
    Height = 225
    Picture.Data = {


  Proportional = True
    Transparent = True
  end
  object Label1: TLabel
    Left = 224
    Top = 48
    Width = 32
    Height = 13
    Caption = 'Login'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWhite
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label2: TLabel
    Left = 224
    Top = 112
    Width = 146
    Height = 13
    Caption = 'Automatic Closure Timer :'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label3: TLabel
    Left = 384
    Top = 112
    Width = 9
    Height = 13
    Caption = '--'
    Color = clWhite
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWhite
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentColor = False
    ParentFont = False
  end
  object Edit1: TEdit
    Left = 224
    Top = 83
    Width = 209
    Height = 21
    TabOrder = 0
  end
  object Panel1: TPanel
    Left = 0
    Top = 216
    Width = 600
    Height = 5
    Color = clRed
    ParentBackground = False
    TabOrder = 1
  end
end
EndDialog>Dialog7

Show>Dialog7

repeat>asw
add>asw,1
setdialogproperty>Dialog1,Edit3,Caption,%asw%
wait>1
until>asw=15
JRL - I had to remove the pic data in two sections of this dialog. Or it was just "stupid long". Please post your results.

Thanks.

edit - if you feel bored, I can post the pics. :D
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Feb 20, 2011 8:00 am

Edit boxes don't have captions. Don't you want to change the TEXT of the edit box. Don't you mean:

setdialogproperty>Dialog1,Edit3,Text,%asw%
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

code

Post by PepsiHog » Sun Feb 20, 2011 7:19 pm

No. What I want is a timer. In the dialog it has a line that says: Time before Autoclose (or simular)

My "was gonna be solution" was a Label that would change with the variable asw.

If you know how to display a working timer in the dialog, problem solved. But still why would it not work anyway? The idea with v12 is being able to update on-the-fly, so it should work, right?

edit - Thinking about your question, I see what you may be suggesting. That's a good idea. I'll create an edit box and display the changing variable there. That may work. I'll post the results.

Thanks.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

code

Post by PepsiHog » Sun Feb 20, 2011 7:56 pm

The edit box idea works. For some reason you can't update the Label as quickly.

Thanks for the help guys.

Marcus,

I can see people using a timer command for many diifferent ideas. Maybe at some point you could add such a command.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Mon Feb 21, 2011 1:28 pm

Hi PepsiHog,
Change the dialog form style from fsMDIForm to fsNormal or fsStayOnTop.

Here is a working version. I added a tiny image and icon for testing purposes.

Code: Select all

Dialog>Dialog7
object Dialog7: TForm
  Left = 570
  Top = 119
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Eagle Eye - Login'
  ClientHeight = 221
  ClientWidth = 439
  Color = clBlack
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  Icon.Data = {
    0000010001001010020001000100B00000001600000028000000100000002000
    0000010001000000000080000000000000000000000002000000000000000000
    0000FFFFFF000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000
    FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000
    FFFF0000FFFF}
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  LoadIcon = 'Loaded'
  PixelsPerInch = 96
  TextHeight = 13
  object MSImage1: tMSImage
    Left = -1
    Top = 8
    Width = 225
    Height = 225
    Picture.Data = {
      07544269746D617046000000424D460000000000000036000000280000000200
      0000020000000100180000000000100000000000000000000000000000000000
      000000FF0000FF00000000FF0000FF000000}
  end
  object Label1: TLabel
    Left = 224
    Top = 48
    Width = 32
    Height = 13
    Caption = 'Login'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWhite
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label2: TLabel
    Left = 224
    Top = 112
    Width = 146
    Height = 13
    Caption = 'Automatic Closure Timer :'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label3: TLabel
    Left = 384
    Top = 112
    Width = 9
    Height = 13
    Caption = '--'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWhite
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Edit1: TEdit
    Left = 224
    Top = 83
    Width = 209
    Height = 21
    TabOrder = 0
  end
  object Panel1: TPanel
    Left = 0
    Top = 216
    Width = 600
    Height = 5
    Color = clRed
    ParentBackground = False
    TabOrder = 1
  end
end
EndDialog>Dialog7

Show>Dialog7

let>asw=0
repeat>asw
add>asw,1
SetDialogProperty>Dialog7,Label3,Caption,%asw%
wait>1
until>asw=15

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

code

Post by PepsiHog » Mon Feb 21, 2011 7:20 pm

Thanks Rain.

Not an aspect of the dialog I would have suspected. Do you have any thoughts on why this setting would cause an error like this?


Marcus,

I've been having problems with many small aspects of cutomizing a dialog. One is just setting the color of an edit box. Another setting the color of text in a label or edit box. It shows in the setting but doesn't actually work.

Now, after Rain said to change the dialog style, I went back and changed it, and the color settings all started working.

Is there a reason for this? Or is it an issue that needs to be addressed?
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Feb 21, 2011 7:45 pm

Don't know - I've not had a problem setting the colour of edit boxes with the default form style. What steps should I follow to see what you're seeing?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

code

Post by PepsiHog » Mon Feb 21, 2011 8:04 pm

What steps should I follow to see what you're seeing?
Change the dialog form style from fsMDIForm to fsNormal or fsStayOnTop.
Copy Rain's script above. Run it to take note of dialog display. His script works correctly. Now, change the form style to fsMDIForm. Run the dialog again. The problem was with fsMDIForm. You can't change colors.

Or write a simple dialog with a label and edit box. Set the form style to fsMDIForm. Now try to change the color of the label. Now try the same with the edit box.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Feb 22, 2011 7:11 am

I'm guessing this is by design. MDI (Multiple Document Interface) forms are rather special. I would have to look at the delphi docs/source to understand why but I guess there is a reason. It's not something *WE* decided to do. I doubt it's a bug but just an attribute of the form being MDI.

But, anyway, I'm not sure that an MDI form would work inside Macro Scheduler and probably we should have removed the MDIForm and MDIChild options completely. Custom Dialogs are meant to be dialogs, not MDI containers.

Just change the formstyle and don't use fsMDIForm.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts