Ver 12 Dialogs

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Ver 12 Dialogs

Post by kpassaur » Wed Jun 02, 2010 10:24 am

I have a couple of questions on ver 12 Dialogs.

1 - how to set the caption on the form (Window Title)

I would think it would be:
SetDialogProperty>Dialog1,Dialog1,Caption,Name of Form
As on a label it would be:
SetDialogProperty>Dialog1,msLabel1,Caption,Label Text

2 - What settings to use to make it so that when you browse to a folder you can create a new one if it does not exist.

4 - How to enter a file filer to display only a certain file file when browsing I entered *.pdf under filter and it displayed all files.

sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Post by sarver311 » Wed Jun 02, 2010 4:36 pm

Hello,

Here is an example that I believe is what you were asking for regarding your first question

Type something in the box and click update and it will change the windows title and a label to the text in the box.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Left = 1613
  Top = 231
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Change Title'
  ClientHeight = 216
  ClientWidth = 439
  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 Label1: TLabel
    Left = 48
    Top = 104
    Width = 104
    Height = 20
    Caption = 'Example Label'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 40
    Top = 32
    Width = 279
    Height = 33
    Caption = 
      'Type a Value in the box below and click the button to update Win' +
      'dows title and the Example label below.'
    WordWrap = True
  end
  object Edit1: TEdit
    Left = 42
    Top = 65
    Width = 121
    Height = 21
    TabOrder = 8
  end
  object MSButton1: tMSButton
    Left = 45
    Top = 148
    Width = 75
    Height = 25
    Caption = 'Update'
    DoubleBuffered = True
    ParentDoubleBuffered = False
    TabOrder = 9
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,MSButton1,OnClick,updatevalues
show>dialog1,r

srt>updatevalues
  GetDialogProperty>dialog1,edit1,text,editreturn
  SetDialogProperty>dialog1,,caption,editreturn
  SetDialogProperty>dialog1,label1,caption,editreturn
END>updatevalues


I am assuming when you refer to "browse to a folder" you are referring to the input command? I don't know if that command has that functionality. It might be possible if you created a custom dialog.

Here is an example of a drop down box that can filter results based on what you type. This might help with your 4th question.

http://www.mjtnet.com/forum/viewtopic.p ... highlight=

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

Post by Marcus Tettmar » Wed Jun 02, 2010 6:09 pm

1: Use:

SetDialogProperty>Dialog1,,Caption,MyCaption

2: As the browse displays the standard Windows Explorer interface you can just right click anywhere and select New->Folder as you would in Windows Explorer

3: Filter = 'PDF Files|*.pdf'
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Thanks

Post by kpassaur » Wed Jun 02, 2010 6:18 pm

They all work.

I never tried leaving it blank for the Window Title, I was putting in the Dialog name. I also didn't know you could right click to add a folder in that box, I am used to having the "New Folder" Button as in the old version and I am old.

I didn't think to put the filter in that format yet I used to with the old version. I just put in *.pdf without the bar or file type.

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

Post by JRL » Thu Jun 17, 2010 10:28 pm

This has nothing to do with the topic of this thread but everything to do with the title of the thread.

Since legacy dialogs continue to function in release 12, I have not taken any time to rewrite any of my old dialogs. I couldn't see any point to it. Today I had reason to rewrite one because I wanted to add some version 12 functionality. Specifically I wanted to be able to use the OnMouseEnter event. When OnMouseEnter is set in AddDialogHandler> a subroutine is called when the mouse passes over an object.

AddDialogHandler>Dialog1,msButton1,OnMouseEnter,DoSomething

Anyway I was looking at this dialog and thinking I would have to recreate the whole thing. I had a pleasant surprise. If you open a legacy dialog in the version 12 dialog designer, then pick the save icon, when you update the dialog it is all rewritten for you in version 12 code....Very cool! and very convenient.

This may have been discussed before but I missed it if it was. On the other hand it bears repeating.

Hope this is helpful,
Dick

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Dialogs

Post by kpassaur » Thu Jun 17, 2010 10:57 pm

Without question it is very cool the way it reads them. However, for someone reading this, keep in mind you may have to (most likley in my case) redo all the code associated with them.

I use my dialogs to create ini files. Ver 12 is execellent for this. But what I have found is that I have to change a few things.

Before I would just read the ini file and set a variable. In the dialog I would just have the variable.

Now I have to add a line to set the text value. - no big deal

Before I would use %dialog1.var% and then use write line to write the line such as c:\test\test.ini,result,Item = %dialog1.var%

Now I have to use the get function, to get the item from the dialog and assign it to variable and then write the line. So, I have to use two lines to what I did in one before

What I do (keep in mind this is new to me) I read it and assign it to a variable in my ini file such as

VAR

Use the set dialog function to place it in the dialog

then I just add a "G" in front of it when I get it so it becomes "GVAR" when I write the line.

The other thing to keep in mind is the FileBrowse. Forget it, keep in mind you need to use a subroutine (very good example is included).

All in all it takes some time as you have to actually redo quite a bit (well I do as some of mine are quite complex) but it is worth it as the more complex functions are much easier to write.

And I don't mean a little bit easier, I mean a lot easier. I just did one I would not have dreamed of before as it checks everything to make sure it is a valid option. It has a choice of an email address, (with certain options if it is entered) a printer or file folder. Now it can be checked and validated in a few lines of code. Before, forget it, it would takes days of work for me, now 1/2 - 1 hour.

The only negative is that there are so many options you need to scroll through a long list for the ones you are looking for. I'm sure with time there will be some way to handle this as most people will only change two or three things.

User avatar
migro
Macro Veteran
Posts: 152
Joined: Thu Nov 06, 2003 5:23 pm
Location: Germany
Contact:

Post by migro » Sat Oct 30, 2010 6:47 pm

For myself I'm not happy with this "feature" turning old, working Dialogs into new once and nothing works anymore!

I'm using very complex dialogs and a lot of variables in the dialogs and now when I change one element with dialog designer, what costs me normally only a few seconds all is messed up and I need to dig into the new dialog management to get it back running, spending hours or days...
regards
migro

User avatar
migro
Macro Veteran
Posts: 152
Joined: Thu Nov 06, 2003 5:23 pm
Location: Germany
Contact:

Post by migro » Mon Nov 01, 2010 12:03 am

So, after digging a little bit into the new Dialogmanagement, I must say that it eases much things what are before very difficult.

When creating new scripts its very nice (When changing dialogelements in old scripts I will do this in the old dialog code directly :twisted: )
regards
migro

User avatar
migro
Macro Veteran
Posts: 152
Joined: Thu Nov 06, 2003 5:23 pm
Location: Germany
Contact:

Post by migro » Fri Mar 04, 2011 11:48 pm

mtettmar wrote:
2: As the browse displays the standard Windows Explorer interface you can just right click anywhere and select New->Folder as you would in Windows Explorer
Ist it possible that "New->Folder" in the context menu is only available in Win7? I miss it at XP (sp3) systems.
regards
migro

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