Virtual Pascal

Classic Object Pascal for free

Does anyone have code to create a (windows) popup box providing an editable line - whch is returned to the VP program pls?

G'day All

Does anyone have code to create a (windows) popup box providing an editable line - which is returned to the VP program pls?  

Ideally, it should allow for some text to be written to the window title (or a protected field) and

permit 1 or more editable lines.  eg: 3 x 80 lines (making 240 chars visually), would be ok -

providing that they are treated as 1 line . eg: for inserting or deleting characters when editing.

ie: I just need to pop up a box which should provide a long line (at least 240 chars but 255 would be perfect) - which can be primed with a filename - & permit the user to edit it (if desired) ..

and return the result to the VP routine which called it.

This is for a utility I'm writing to fix a large number of files with 'bad'  or 'wrong' filenames - and I can correct most of them in this utility - but I would prefer to permit the user to choose to see the

changes first - if desired. 

Also it is necessary in some special cases, where it isn't possible to automatically choose the best/proper 'correction'.  ..ie the user should decide in these special cases.

The utility is basically a "once-off" .. but who knows, may be useful on other occasions.

NB: I have found routines on the net which provide a popup box - but they only provide for a message

to be displayed - not the ability to edit a field.    Especially a long one!

I have found routines in Opro which can be modified to provide a field - but the length is an issue

ie: not long enough .. & seems to be restricted to a standard 80x25 screen width.

You'd have thought that such a routine would be widely used .. but I can't seem to find anything

suitable.

Any ideas pls?

Many Thanks

Barry

Views: 170

Reply to This

Replies to This Discussion

Hi Barry,

I've made for you a small dialog box with an edit control and two buttons, "OK" and "Abort". The dialog box can be called within your program.

This is what you'll find in the joined archive file :

  • filename.rc : the resource file of the dialog ;
  • filename.inc : the constants to be included in your program ($I directive) ;
  • filename.res : the compiled resource file ($R directive) ;
  • filename.rws : the (optional) Borland Resource Workshop settings ;
  • barry.pas : the source file, with a small program to test the dialog box ;
  • barry.exe : the test program.

Maybe you'll want to edit the properties of the edit control to add an horizontal scrollbar.

Hope this will help you. :)

Bye for now,

Alcatiz.

Attachments:

G'day Alcatiz

That's very kind of you - much appreciated.

I've dl'ded it & will get back into it as soon as I can.

Just at the moment I'm desperately trying to recover from a

bad crash which has stuffed up my partitions - incl the one

with all my Pascal code ...  Yes, I know .. should have backed

it all up earlier ... <sigh>     I do have backups but hadn't done

it for a week or two ...      ....Murphy's Law eh?

Hopefully another day or two should see it all back together

.. I hope - and I'll get straight back into it then!  

Thanks again.

Barry

Hello gentlemen !

I had not visited the forum for a while, and I am glad to find an Alcatiz's code example today.

@Alcatiz

Would it be possible to turn your dialog box in a stand-alone program like this one :

InputBox

Best regards.

Roland

G'day Roland - you see Barry taught me some Strine ! :)

So you mean a program, called within a process, displaying a dialog box ? It must be possible.

The tool you found seems to be powerful.

Regards,

Alcatiz

Thank you for your answer, Alcatiz. Yes, one would think that you are a real Australian man. :)

Indeed, the tool looks simple, but it's very well done.

I was simply wondering if I could open a tFileNameDlg directly from a console application, as I do with the MessageBox function. If it is possible, could you indicate the modifications to do to your code ?

In other words, I would like to get something like the Delphi InputBox function.

A good way to do this is to use a tDlgWindow as main window. If you need many options, as the InputBox you found, you can create controls or edit their properties dynamically.

Thank you, Alcatiz.

 

RSS

© 2017   Created by Allan Mertner.   Powered by

Report an Issue  |  Terms of Service