Solved

More dialogs

Posted on 1998-11-05
8
163 Views
Last Modified: 2010-04-16
what running dialogs boxes in TPW 1.5 i need to know how to put in values to edit boxes as soom as they are run.
0
Comment
Question by:pobwest
  • 4
  • 3
8 Comments
 
LVL 2

Expert Comment

by:joe_h
ID: 1215973
do you mean the default values that appear in an edit box as soon as the dialog appears?

0
 

Author Comment

by:pobwest
ID: 1215974
no, i can put in default values using the workshop, i need to know how to pass variables into them when they are executed.



 
0
 
LVL 27

Expert Comment

by:BigRat
ID: 1215975
If you are programming with object pascal then you have a PEdit object and you can call the setText method.
   If you are programming with raw windows (à la Petzold as I say) then we are going to write SendDlgItemMessage(hDlg,IDD_ITEM,EM_SETTEXT,0,Long(PChar(@Text))); or something similar!
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:pobwest
ID: 1215976
not quite what i meant.

When i run a dialog with:
 Application^.ExecDialog(New(PMyDialog, Init(@Self, DIALOG_2')));    

I want value to appear staight away, ie loaded from suitable variables.

I know how to send the data there:
 
setdlgitemint(Hwindow,250,Share_Pointer,false);

for example; but i need this to be run as soon as the dialog box is initiated.
   
0
 
LVL 27

Expert Comment

by:BigRat
ID: 1215977
You have a type TMyDialog and PMyDialog = ^TMyDialog. The object TMyDialog is probably extended from TDialog. The method SetupWindow is called on WM_INITDIALOG and at this point the "handle to window" TMyDialog.hWindow is valid and you can call setdlgitemint if you want.
0
 

Author Comment

by:pobwest
ID: 1215978
I'm still a bit lost with this dialog thing malarky.
Could you write down how you would run a dialog designed in resource work shop and enter values in it to see if I'm on the right lines?
0
 

Author Comment

by:pobwest
ID: 1215979
ha, stumped you all hey?
0
 
LVL 27

Accepted Solution

by:
BigRat earned 70 total points
ID: 1215980
Stumped not, I forgot to mark my reply with e-mail notification! Probably I was asleep like a dormouse.
   When you wrote TMyDialog you specified an Init procedure (the constructor) which takes two parameters, the Window above (on the call specified as @self) and the name of the dialog resource (DIALOG_2 which you made in resource workshop).
   First your Init constructor does not pass any variables which you could put in the boxes. You could make them global, or you could pass them by changing the definition of the constructor. You cannot in the constructor put these values into the boxes since there is no hWindow at this time. One does this at window initialisation time, namely when SetupWindow is called. So we design it as follows :-

const
   BoxId = 123;    (* IdNr of box in dialog from ResourseWorkshop *)
type
    TMyDialog   = object(TDialog)

                          Value1 : Integer;

                          constructor Init(AParent : PWindowsObject;
                                                AName  : PChar;
                                                AValue  : Integer);
                           procedure SetupWindow; virtual;
                           .....
                           end;

constructor TMyDialog.Init(AParent : PWindowsObject;
                                       AName  : PChar;
                                       AValue  : Integer);
  begin
   inherited Init(AParent,AName);
   (* save parameter for later *)
   Value1:=AValue;
  end;

procedure TMyDialog.SetupWindow;
  begin
   (* initialize my boxes *)
   SetDlgItemInt(hWindow,BoxId,Value1,false);
   (* etc... *)
  end;
 
Is that clear? And does Rat get the cheese?
 

   
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
February 24, 2017 — On February 23, Travis Ormandy, a vulnerability researcher at Google, reported on Twitter (https://twitter.com/taviso/status/834900838837411840) that massive stores of data have been leaked by CloudFlare, a company that provide…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question