Copy and Paste Dialog

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
colin.rogers
Newbie
Posts: 11
Joined: Sat Oct 28, 2017 11:49 am

Copy and Paste Dialog

Post by colin.rogers » Mon Nov 13, 2017 1:56 am

Hi team,

I seems that whenever I try to copy and paste code containing a Dialog and then Run I receive an error.
For example, with this very simple Dialog only:

Dialog>Dialogtest
object Dialogtest: TForm
  Left = 244
  Top = -842
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Table Selection'
  ClientHeight = 520

  ClientWidth = 512
  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
end
EndDialog>Dialogtest

I am seeing a message box: error in _debug.dbg, Line 1 unable to load content for dialog: Dialogtest, error in dialog block.

I have coded a Dialog successfully from scratch in another routine and this error is happening only when copy and paste is used.

What am I doing wrong ?

Thanks !

Further diagnostics using Dialog Designer in the latest Pro version.

Dialog1 below was created from scratch using Dialog Designer and for troubleshooting purposes it has been cut down to the "Caption" property only with a value 'Test 1'.
Dialog 4 below was pasted in from the forum and also cut down.
When Dialog1 is selected and edited, the Caption can be changed and Dialog Designer shows the expected Caption value. When running the macro itself, Dialog1 is clean but Dialog4 throws the error described above. Also, the 'end' line in Dialog4 is being highlighted by the editor in red, which is not the case for the same line in Dialog1.

Meanwhile, when the 'Caption' line from Dialog4 is pasted into Dialog1 and Dialog1 is selected and edited, Dialog Designer then shows only a Caption value of 'Custom Dialog' and the error message is now thrown by Dialog1.

Dialog>Dialog1
object Dialog1: TForm
Caption = 'Test 1'
end
EndDialog>Dialog1

Dialog>Dialog4
object Dialog4: TForm
  Caption = 'Test 4'
end
EndDialog>Dialog4

Is this a bug in Dialog Designer or my misunderstanding of what to expect ?

Thanks.

Colin Rogers

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

Re: Copy and Paste Dialog

Post by Marcus Tettmar » Mon Nov 13, 2017 6:28 pm

When I copy and paste all your examples they load and run flawlessly. So I have to say I'm baffled at this point.

What browser are you copying from? I'm wondering if there are some spaces/control characters getting into the text somehow.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

colin.rogers
Newbie
Posts: 11
Joined: Sat Oct 28, 2017 11:49 am

Re: Copy and Paste Dialog

Post by colin.rogers » Tue Nov 14, 2017 12:23 am

Support explained that the red "end" is just the syntax highlighter getting confused with end subroutine - no actual impact on the macro.

However, some invisible control chars were getting in the way. When I tried Edit/Show All Chars that showed a different tab was inserted by the Paste and when this was deleted and replaced with the normal editor tab then the script began to work as expected.

Thanks to the support team.

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