Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show Confirm Dialog like Windows 10 Pro

Status
Not open for further replies.

Irwin1985

Programmer
Feb 2, 2017
44
ES
Hi everybody,

Is there any Windows API that show a confirm dialog like shown image below?

Some friends of mine has made it on theirs VFP apps and i wonder if they did it using Windows API or just by Class Library designing.

If it's so, please post an example.

Thanks...!

Windows10ConfirmDialog_i93oms.png
 
I don't know about an API, but that would not be hard to create as a form, passed the various parameters

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I doubt if there is an API call that actually displays this dialogue. After all, what would be the point of just displaying the dialogue? You would also need to code the actual copying of the file, the test for whether the file already exists, and the action to be taken according to the user's choice.

But I might be wrong about that. Why don't you try it for yourself? Just SET SAFETY ON, then try to copy one file over another, using COPY FILE. You will get a dialogue asking you whether you want to overwrite. See for yourself whether that is the dialogue in your screen shot, or the boring Yes / No / Cancel message box that you see in older versions.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike, The image was an example just for showing the confirm dialogue style. Off course I can make it by my self using simple form but i dont want to do it that way, that's why i ask for Windows API integration.

Thanks...!
 
That's quite clever Mike

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Irwin, you say the form that you showed is just an example. An example of what exactly? If you mean an example of a dialogue that appears when you try to copy one file over another ... well, that's obvious. If it's not that, what type of dialogue do you want to create (that this one is an example of)?

Also, you mentioned that your friends have an app that shows this kind of dialogue. Have you considered asking those friends how they did it?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Sedna had the VistaDialogs4COM as one component:
Edit: By the way the screenshot you show rather looks Aero/Vista, not Win10. Win10 has flat windows, which are even easier to emulate with no border, no theme using Labels for any text and Containers with white border to emulate flat buttons.

Bye, Olaf.
 
Hi guys, I've found the solution by using the CodeJock ActiveX Components.

Thanks you all...!
 
Irwin,
I like this idea... how did you solve it with the CodeJock?
Can you put an example up, I wouldn't mind trying this in my own app, now that you mention it.


Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
OfCourse, here's the example.

Code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	DoCreate 	= .T.
	Caption 	= "Form1"
	*-- XML Metadata for customizable properties
	_memberdata = ""
	Name 		= "Form1"


	ADD OBJECT taskdialogmarkup AS olecontrol WITH ;
		Top 		= 12, ;
		Left 		= 12, ;
		Height 		= 28, ;
		Width 		= 16, ;
		oleClass 	= "Codejock.TaskDialog.15.3.1",;
		Name 	= "taskDialogMarkup"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top 		= 72, ;
		Left 		= 24, ;
		Height 		= 96, ;
		Width 		= 312, ;
		FontSize 	= 12, ;
		Caption 	= "\<Show TaskDialog", ;
		Name 		= "Command1"


	ADD OBJECT taskdialog AS olecontrol WITH ;
		Top 		= 12, ;
		Left 		= 36, ;
		Height 		= 100, ;
		Width 		= 100, ;
		oleClass 	= "Codejock.TaskDialog.15.3.1",;
		Name 		= "taskDialog"


	PROCEDURE loaddialogs
		Local gnFileHandle,nSize,cString
		gnFileHandle = FOPEN("C:\Dialogs.xml")
		* Seek to end of file to determine number of bytes in the file.
		nSize =  FSEEK(gnFileHandle, 0, 2)     && Move pointer to EOF
		IF nSize <= 0
		 * If file is empty, display an error message.
		 WAIT WINDOW "This file is empty!" NOWAIT
		ELSE
		 * If file is not empty, store the file's contents in memory
		 * and display the text in the main Visual FoxPro window.
		 = FSEEK(gnFileHandle, 0, 0)      && Move pointer to BOF
		 cString = FREAD(gnFileHandle, nSize)
		ENDIF
		= FCLOSE(gnFileHandle)         && Close the file
		RETURN cString
	ENDPROC


	PROCEDURE command1.Click
		Thisform.TaskDialog.Reset()
		Thisform.TaskDialog.CommonButtons = 0
		Thisform.TaskDialog.CreateFromXML(thisform.LoadDialogs(),"Dialogs/Dialog[@Name='Dialog002']")
		MESSAGEBOX(Thisform.TaskDialog.ShowDialog())
	ENDPROC

ENDDEFINE
*
*-- EndDefine: form1
**************************************************
* Dialogs.xml
*<?xml version="1.0" encoding="UTF-8"?>
*<Dialogs xmlns="[URL unfurl="true"]http://www.codejock.com/schema/TDSchema.xsd">[/URL]
*	<Dialog AllowCancel="false" Name="Dialog002">
*		<WindowTitle>MyTitle</WindowTitle>
*		<MainInstruction Image="*Information">My SubTitle</MainInstruction>
*		<Content>¿Here's the Question or Message Content?</Content>
*		<Buttons Default="1">
*			<CommandLink Shield="true" ID="1">
*				<Text>Yes Or Accept</Text>
*				<Explanation>Button 1 Hint</Explanation>
*			</CommandLink>
*			<CommandLink ID="2">
*				<Text>No or Cancel</Text>
*				<Explanation>Button 2 Hint.</Explanation>
*			</CommandLink>
*		</Buttons>
*	</Dialog>
*</Dialogs>
**************************************************
 
This is probably a good solution. I've used the Codejock ActiveX controls in several projects. They can greatly enhance the appearance of your application.

In this particular case, I probably would have created my own form from scratch using native VFP, but in general Codejock is a good place to look for this type of thing.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
You're right Mike,

CodeJock has severals ActiveX components but there's just 1 or 2 VFP examples. What I do is analyze the VB6 examples and translate into VFP code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top