Page Control - Active Page

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Page Control - Active Page

Post by Jerry Thomas » Tue Aug 18, 2015 5:08 pm

I need to know which tab of the Page Control the user has selected.

There is an Active Page property for Page Control, but that returns a handle for the active tab.

Is there a way to get the name of the tab?

<edit - code sample added>

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Left = 424
  Top = 301
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 261
  ClientWidth = 255
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -14
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 120
  TextHeight = 16
  object PageControl1: TPageControl
    Left = 30
    Top = 21
    Width = 200
    Height = 193
    ActivePage = Page2
    TabOrder = 0
    object Page1: TTabSheet
      Caption = 'Page1'
      ExplicitWidth = 281
    end
    object Page2: TTabSheet
      Caption = 'Page2'
      ExplicitWidth = 189
    end
  end
  object Btn1: tMSButton
    Left = 30
    Top = 221
    Width = 200
    Height = 25
    Caption = 'Show Current Page Name'
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog1

ADH>Dialog1,Btn1,OnClick,ShowPage

Show>Dialog1,r

SRT>ShowPage
  GDP>Dialog1,PageControl1,ActivePage,CurrentPage
  MDL>CurrentPage
END>ShowPage
Thanks,
Jerry

[email protected]

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Re: Page Control - Active Page

Post by Jerry Thomas » Tue Aug 18, 2015 6:10 pm

Answering my own question... :oops:

GDP>Dialog1,PageControl1,TabIndex,CurrentPage

CurrentPage shows the tab number (zero based) which will work fine
Thanks,
Jerry

[email protected]

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