Edit box Focus

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

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

Edit box Focus

Post by PepsiHog » Sat Oct 09, 2021 9:17 pm

Hello Everyone,
I can not remember how to set focus to an object. The object is an edit box. When the dialog opens I want the cursor to be in this particular edit box.

Will you refresh my memory how to do this?

Thanks,
PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) 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
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Edit box Focus

Post by Grovkillen » Sun Oct 10, 2021 5:20 am

Set focus on the dialog instead of the element?
Let>ME=%Script%

Running: 15.0.24
version history

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

Re: Edit box Focus

Post by JRL » Mon Oct 11, 2021 12:27 pm

Use SetDialogObjectFocus>

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Left = 551
  Top = 216
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 211
  ClientWidth = 476
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Edit1: TEdit
    Left = 133
    Top = 19
    Width = 121
    Height = 21
    TabOrder = 8
    Text = 'Edit1'
  end
  object Edit2: TEdit
    Left = 135
    Top = 58
    Width = 121
    Height = 21
    TabOrder = 9
    Text = 'Edit2'
  end
  object Edit3: TEdit
    Left = 135
    Top = 97
    Width = 121
    Height = 21
    TabOrder = 10
    Text = 'Edit3'
  end
  object Edit4: TEdit
    Left = 135
    Top = 134
    Width = 121
    Height = 21
    TabOrder = 11
    Text = 'Edit4'
  end
end
EndDialog>Dialog1

SetDialogObjectFocus>Dialog1,Edit3

Show>Dialog1,

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

Re: Edit box Focus

Post by PepsiHog » Mon Oct 11, 2021 3:53 pm

Thanks JRL.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) 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!

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