SOLVED! Dialog Designer Copy and Paste Conceptual problem

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

SOLVED! Dialog Designer Copy and Paste Conceptual problem

Post by mightycpa » Mon Feb 23, 2015 3:25 am

Hi Marcus,

As you know, I've been trying to duplicate a complicated form so that I don't have to reinvent the wheel from scratch. So far, I can only duplicate simple forms from your examples.

In working with the Dialog Designer over the weekend, it has occurred to me that I don't quite understand something.

First, I sometimes have trouble closing the dialog designer. I think I finally figured out it was because I was clicking the red x on the dialog desginer window, rather than the window with all the icons in it. Doing that leads to a lot of trouble.

Mainly, I'm confused by the purpose of the functionality of the icon "Load from Clipboard".

I created a Dialog1, and I saved it to the clipboard.
I edited that dialog by moving an object in the editor and saved it to the editor.
Next I opened a brand new dialog, placed a random object on it, and saved it to the editor, creating Dialog2
I then right clicked Dialog2 so that I could edit it.
Next, I loaded from the clipboard. The contents of Dialog1 appeared as they did before my object move, and my random object disappeared.

so far, so good... in fact, really cool. The next step threw me for a complete loop.

Next, I saved it to the editor. The code didn't change at all; after saving, the code showed my random object in a blank window. When I opened Dialog2 again in the Dialog editor, the random object was the only thing on the form. Everything I had copied from the clipboard was gone.

Next, I opened up Dialog1 in the editor. My moved object moved back to its original position. That's where the clipboard contents were saved, even though I was not working on that dialog object. :shock:

So I'm asking myself what this icon i actually for. It seems to be no different than right clicking to edit a dialog block, but if you've got to do that anyway to get to the editor, it seems almost useless. I suppose it could be used so that you could rollback your dialog changes to the previous clipboard change, but that makes it almost as dangerous as it is useful. It would be far better to save your script, and hold your changes in the automatic backups made by MS.

What would really be nice is if you could modify the code in the editor, then "Load from Script" to the Dialog Designer and see the changes appear.

Also, it would be really nice if you could do what I did up above, and then save it, and watch that appear in your code in the Dialog you were working on. I realize you'd have to deal with naming conflicts, but that doesn't seem like a big problem.

Long story short, I don't get it. I think the two things I suggested would be really nice to have. I have no idea how or why I would use the "Load from Clipboard" icon.

Can you go into some explanation about that, and about how to always successfully duplicate a Dialog?

Thanks
Last edited by mightycpa on Mon Feb 23, 2015 4:34 pm, edited 1 time in total.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

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

Re: Dialog Designer Copy and Paste Conceptual problem

Post by Marcus Tettmar » Mon Feb 23, 2015 9:25 am

Historically the only way to edit a dialog was to copy it to the clipboard first.

You can now do so simply by having the cursor on the first line.

So I suppose the answer is: it's a legacy thing.

Right now, to duplicate a dialog you should be able to copy and paste it and then change the name. There are three places the name is referenced.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: Dialog Designer Copy and Paste Conceptual problem

Post by mightycpa » Mon Feb 23, 2015 2:43 pm

Yes, that's what I was hoping for, but it doesn't always work that way. I've included a movie to show you. Maybe I"m missing a step. I'm not sure if it is just the preview, but this seems to start in the middle for some reason. The beginning of the movie has a white title on black.

Image

By the way, it doesn't save it in the original Dialog1 either.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

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

Re: Dialog Designer Copy and Paste Conceptual problem

Post by Marcus Tettmar » Mon Feb 23, 2015 3:41 pm

I am unable to replicate. I don't think you're missing anything. I don't understand why it wouldn't be updating.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: Dialog Designer Copy and Paste Conceptual problem

Post by mightycpa » Mon Feb 23, 2015 3:49 pm

Can you try this and see what happens?

Code: Select all

Dialog>Dialog1
object Dialog1: 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
  object msLabel1: TLabel
    Left = 16
    Top = 7
    Width = 169
    Height = 18
    Caption = 'Click table name to reprocess table'
  end
  object msLabel2: TLabel
    Left = 16
    Top = 185
    Width = 457
    Height = 13
    Caption =
      'Enter new tables to process using a fully qualified table name (' +
      'e.g. IMAPPSTG.DBO.IW_TABLE:)'
  end
  object msLabel3: TLabel
    Left = 16
    Top = 247
    Width = 338
    Height = 13
    Caption =
      'These tables will be processed. Click table name to remove from ' +
      'the list.'
  end
  object MSNewTable: TEdit
    Left = 16
    Top = 208
    Width = 350
    Height = 21
    TabOrder = 8
  end
  object msButton2: tMSButton
    Left = 376
    Top = 208
    Width = 65
    Height = 25
    Caption = 'Add New'
    Default = True
    ParentShowHint = False
    ShowHint = False
    TabOrder = 9
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object msButton4: tMSButton
    Left = 362
    Top = 422
    Width = 75
    Height = 25
    Caption = 'Finished'
    ModalResult = 4
    ParentShowHint = False
    ShowHint = False
    TabOrder = 10
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSStringGrid1: tMSStringGrid
    Left = 15
    Top = 24
    Width = 418
    Height = 145
    ColCount = 1
    DefaultRowHeight = 16
    FixedCols = 0
    RowCount = 8
    TabOrder = 11
    ColWidths = (
      412)
  end
  object MSStringGrid2: tMSStringGrid
    Left = 15
    Top = 264
    Width = 426
    Height = 145
    ColCount = 2
    DefaultRowHeight = 16
    FixedCols = 0
    RowCount = 8
    TabOrder = 12
    ColWidths = (
      33
      381)
  end
end
EndDialog>Dialog1
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: Dialog Designer Copy and Paste Conceptual problem

Post by mightycpa » Mon Feb 23, 2015 4:00 pm

Marcus,

I did what you're going to do, which is to take my code, open a new file, and try this duplication process. It works, no problem.

Then I did what you can't do. I copied the modified "Dialogtest" to my large script. I pasted it in, then edited it. All changes appeared in the editor.

So far, so good.

Next, I changed the Caption again. Then I saved it to the editor.

The save did not work. It has something to do with my script... not sure if it is a characteristic of MY script, or maybe something having to do with the size of the script.

I will continue to pursue. You must have some large scripts hanging around. Can you try putting it in one of those? I will try another large script. Something is making it act this way.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: Dialog Designer Copy and Paste Conceptual problem

Post by mightycpa » Mon Feb 23, 2015 4:33 pm

I figured it out. Take a look at this

Code: Select all

/*******************************
********************************
what about now?
/********************************
********************************/
While they syntax is technically correct, your Dialog Editor doesn't like this additional slash character in there at all:

/*******************************
********************************
what about now?
/********************************
********************************/

The regular editor doesn't mind, but the Dialog Editor must be treating the comments as being nested, and therefore nothing is ever saved. Maybe it can't find the code to save.

If I remove it, everything works just fine.

Well, I learned something. :oops: Thanks for your support.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

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