No way for AddDialogHandler to go to a label?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Scones
Junior Coder
Posts: 32
Joined: Fri Jul 05, 2019 11:21 am

No way for AddDialogHandler to go to a label?

Post by Scones » Wed Feb 26, 2020 8:24 am

This will give an error saying:
Subroutine/Label MyLabel Not Found!

Code: Select all

Label>MyLabel

Dialog>Dialog1
object Dialog1: TForm
  Left = 776
  Top = 138
  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 GoToMyLabel: tMSButton
    Left = 192
    Top = 94
    Width = 81
    Height = 25
    Caption = 'Go to my label'
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,GoToMyLabel,OnClick,MyLabel
Show>Dialog1,r
Goto>MyLabel
Exit
The error dialog says that it does look for labels, but apparently it only goes for SRTs?

I'm trying to make a dialog button go back to an earlier part of my script, and it doesn't allow me to put a GOTO inside an SRT, so i'm not sure how to get there.

Thanks in advance! :P

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

Re: No way for AddDialogHandler to go to a label?

Post by Marcus Tettmar » Wed Feb 26, 2020 12:56 pm

No, it's for subroutines. Labels are hard to follow but if you must you could use SkipLabel in your subroutine:

Code: Select all

AddDialogHandler>Dialog1,MSButton1,onClick,doClick
Show>Dialog1,r
Exit>0

Label>myLabel
MDL>Hello

SRT>doClick
  SkipLabel>myLabel
END>doClick
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Scones
Junior Coder
Posts: 32
Joined: Fri Jul 05, 2019 11:21 am

Re: No way for AddDialogHandler to go to a label?

Post by Scones » Wed Feb 26, 2020 1:05 pm

SkipLabel solves it! Didn't know it existed. Thanks!

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