Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why can't I release this form
Message
De
01/07/2005 09:50:33
 
 
À
01/07/2005 03:34:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Divers
Thread ID:
01027989
Message ID:
01028131
Vues:
14
Peter --

Thanks for your response, which duplicated Sergey's.

As for the problem with the name of the result -- well, I probably would not have noticed that, even when I was doing the final cleanup. So, thank you as well.

Jim


>Jim,
>
>Replace the .SHOW() with .VISIBLE = .T.
>
>BTW, your routine will need some more changes, e.g. 'RETURN gcReturnValue' appears to return a numerical value.
>
>
>>I've been working on a simple-minded replacement for Messagebox. I've seen references to such around, but decided it might be worthwhile to try my own.
>>
>>So far, so good. The following does pretty much what I want:
>>
AlertMsg("Here you go", "Yes;No;Anything", "Title")
>>
>>So, my simple question: when I click on one of the command buttons, why doesn't the form close? It only closes when I click on the X in the upper right hand corner.
>>
>>Thanks in advance
>>
>>
*  Replacement for MESSAGEBOX?
>>PARAMETERS gcPrompt, gcCaptions, gcTitleCaption, gcPromptFontSize, gcButtonFontSize
>>
>>RELEASE _AlertMsgForm
>>PUBLIC _AlertMsgForm
>>_AlertMsgForm = CREATEOBJECT("TempForm")
>>
>>LOCAL lcPrompt, lnBtn, laCaptions(1)
>>LOCAL lcHeight, lcLeft, lnButtons, lcName, lnI, lcFocus
>>PRIVATE gcReturnValue
>>
>>gcReturnValue = 0
>>lcPrompt = CHRTRAN(gcPrompt,'|',CHR(13))
>>lcPrompt = STRTRAN(lcPrompt,CHR(13),CHR(13)+CHR(10))
>>
>>WITH _AlertMsgForm
>>	.WINDOWTYPE = 1
>>	.HEIGHT 		= 36
>>	.WIDTH 		= 134 && apparently, the minimum!
>>	.CAPTION 	= ""
>>	.NAME 		= "AlertMsg"
>>	.TITLEBAR	= 1
>>	.CAPTION    = EVL(gcTitleCaption, "FYI")
>>	.MINBUTTON  = .F.
>>	.MAXBUTTON  = .F.
>>
>>	.FONTSIZE   = EVL(gcPromptFontSize, 11)
>>
>>	.ADDOBJECT('lblPrompt','Label')
>>	WITH .lblPrompt
>>		.FONTSIZE 	= 9
>>		.LEFT 		= 20
>>		.TOP 			= 10
>>		.WIDTH 		= 20
>>		.BACKSTYLE 	= 0
>>		.CAPTION		= lcPrompt
>>		.WORDWRAP   = .T.
>>		.HEIGHT     = .PARENT.TEXTHEIGHT(lcPrompt)
>>		.WIDTH      = .PARENT.TEXTWIDTH(lcPrompt)
>>		.FONTSIZE   = EVL(gcPromptFontSize, 11)
>>		.VISIBLE		= .T.
>>	ENDWITH
>>
>>	lcHeight = .lblPrompt.TOP + .lblPrompt.HEIGHT + 16
>>	lcLeft = 20
>>
>>	lnButtons = ALINES(laCaptions, EVL(gcCaptions, 'OK'), ';')
>>	lcFocus   = .F.
>>	FOR lnI = 1 TO lnButtons
>>		lcName = 'Btn'+TRANSFORM(lnI)
>>		.ADDOBJECT(lcName, "TempButton")
>>		WITH .&lcName
>>			lcCaption = laCaptions(lnI)
>>			IF '|' # LEFT(lcCaption,1)
>>				.CAPTION = '\<'+lcCaption
>>			ELSE
>>				.CAPTION = '\<'+SUBSTR(lcCaption,2)
>>				lcFocus = lcName
>>			ENDIF
>>
>>			.FONTSIZE     = EVL(gcButtonFontSize, 10)
>>			.ButtonNumber = lnI
>>			.TOP = lcHeight
>>			.LEFT = lcLeft
>>			.VISIBLE = .T.
>>
>>			lcLeft = lcLeft + .WIDTH + 12
>>		ENDWITH
>>	ENDFOR
>>
>>	.HEIGHT = lcHeight + .Btn1.HEIGHT + 10
>>	.WIDTH  = .lblPrompt.WIDTH+40
>>	.WIDTH  = MAX(.WIDTH, lcLeft + 8)
>>	.lblPrompt.LEFT = (.WIDTH - .lblPrompt.WIDTH)/2
>>
>>	IF NOT EMPTY(lcFocus)
>>		.&lcFocus..SETFOCUS
>>	ENDIF
>>	.AUTOCENTER = .T.
>>	.SHOW
>>
>>ENDWITH
>>
>>RETURN gcReturnValue
>>
>>
>>DEFINE CLASS TempForm AS FORM
>>	SHOWWINDOW  = 1
>>ENDDEFINE
>>
>>DEFINE CLASS TempButton AS COMMANDBUTTON
>>	AUTOSIZE = .T.
>>	ButtonNumber = 0
>>
>>	PROCEDURE CLICK
>>		gcReturnValue = THIS.ButtonNumber
>>		THISFORM.RELEASE
>>	ENDPROC
>>ENDDEFINE
>>
Jim Nelson
Newbury Park, CA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform