Page 1 sur 2
affichage de question a l'ecran

Publié:
16 Juin 2003 à 09:28
par leila
Bonjour a tous!Je voudrais savoir comment on fait pour afficher a l'écran une question et réucpérer la réponse de l'utilisateur (entrée au clavier) pour pouvoir passer celles-ci en parametre pour lancer une fonctionMerci
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 09:32
par Stephane Maillard
BonjourDim Reponse As VariantReponse = Messagebox("La question ?", 4 + 32, "Le titre")If Reponse = 6 Then ' J'ouvre la porteElse ' Je ne vais rienEnd IfRegarde dans l'aide pour tous les codes de Messagebox.[%sig%]
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:03
par leila
Je vais tester ce code, mais je n'ai pas tres bien compris pourquoi vous écrivez 4+32 et ensuite une virgule et "le titre"....pouvez vous m'expliquer svpMerciiiiii
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:06
par leila
une petite précision le code que vous m'avez envoyé pemet a l'utilisateur de répondre par oui ou par non, il ne lui permet pas d'entre au clavier les noms de fichiers désirés
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:06
par Raziel
Salut,4 + 32 corresponde aux icones et boutons qui vont apparaite dans la message box. ( 4 -> Bouton YES/NO . 32 ->icone question)Je te conseille plutôt de passé par les constante s. Pour cela, tu inclus le fichier de constante comme ceci : %Include "lsconst.lss"Ensuite, tu remplacesReponse = Messagebox("La question ?", 4 + 32, "Le titre")parReponse = Messagebox("La question ?", MB_YESNO + MB_ICONQUESTION, "Le titre")
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:08
par Stephane Maillard
Re,Le 4 c'est pour avoir sur la boîte de dialogue un bouton Oui et Non, le 32 c'est pour avoir l'incône Question.Ci-dessous l'aide Designer

isplays a message in a message box and waits for user acknowledgment. The function form returns a value corresponding to the button the user presses.Function SyntaxMessageBox ( message [ , [ buttons + icon + default + mode ] [ , boxTitle ] ] )Statement SyntaxMessageBox message [ , [ buttons + icon + default + mode ] [ , boxTitle ] ]The MessageBox function and statement are identical, except that only the function has a return value.MsgBox is acceptable in place of MessageBox.ElementsmessageThe message to be displayed in the message box (a string). message can be up to at least 512 characters in length.buttonsDefines the number and type of buttons to be displayed in the message box: Constant name Value Buttons displayed MB_OK 0 OK MB_OKCANCEL 1 OK and Cancel MB_ABORTRETRYIGNORE 2 Abort, Retry, and Ignore MB_YESNOCANCEL 3 Yes, No, and Cancel MB_YESNO 4 Yes and No MB_RETRYCANCEL 5 Retry and Cancel iconDefines the icons to be displayed in the message box: Constant name Value Icon displayed MB_ICONSTOP 16 Stop sign MB_ICONQUESTION 32 Question mark MB_ICONEXCLAMATION 48 Exclamation point MB_ICONINFORMATION 64 Information defaultDefines the default button in the message box. Pressing ENTER has the same effect as clicking the default button: Constant name Value Default button MB_DEFBUTTON1 0 First button MB_DEFBUTTON2 256 Second button MB_DEFBUTTON3 512 Third buttonmodeDefines the message box modality Constant name Value Description MB_APPLMODAL 0 Application modal. Stops the current application until the user responds to the message box. MB_SYSTEMMODAL 4096 System modal. Stops all applications until the user responds to the message box.boxTitleThe string to appear in the title bar of the message box. boxTitle can be up to 128 characters in length.Return valueThe MessageBox function return value is an integer in the range 1 to 7, inclusive. This value indicates which button the user pressed in the message box, as shown in the following table. Return value Button Constant 1 OK IDOK 2 Cancel IDCANCEL 3 Abort IDABORT 4 Retry IDRETRY 5 Ignore IDIGNORE 6 Yes IDYES 7 No IDNOUsageThe valid values for the buttons, icon, default, and mode elements listed in the preceding tables are defined as constants in the file LSCONST.LSS. If you want to use the constants instead of numbers, include this file in your script.The Lotus product where you are running LotusScript may allow longer strings than described above for message and boxTitle. LotusScript will support longer strings for these items if the Lotus product does.Use the newline character (create it with Chr(10)) to force line breaks in the message element. Or use vertical bars or braces to specify a multiline string. If you don't force line breaks, the text wraps automatically in the message box.If you are using LotusScript from within Lotus Notes, note that the MessageBox function writes to:A dialog box when executing in the foreground on a Notes client. The user clicks OK, Cancel, Abort, Retry, Yes, or No to continue.NOTES.LOG when executing on a Domino server without pausing or as a scheduled agent in the Notes client.[%sig%]
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:10
par Stephane Maillard
Re,Erreur de ma part

im num As Integernum% = CInt(InputBox$("How many do you want?"))Messagebox num%Voici l'aide

isplays a dialog box containing a prompt for user entry, and returns input from the user as a string.Syntax InputBox[$] ( prompt [ , [ title ] [ , [ default ] [ , xpos , ypos ] ] ] )ElementspromptA string expression. This is the message displayed in the dialog box. prompt can be up to 128 characters in length.titleOptional. A string expression. This is displayed in the title bar of the dialog box. title can be up to 128 characters in length.If you omit title, nothing is displayed in the title bar. If you omit title and specify either default or xpos and ypos, include a comma in place of title.defaultOptional. A string expression. This is displayed in the text entry field in the dialog box as the default user response. default can be up to 512 characters in length.If you omit default, the text input box is empty. If you omit default and specify xpos and ypos, include a comma in place of default.xposOptional. A numeric expression that specifies the horizontal distance, in units of 1 pixel, between the left edge of the dialog box and the left edge of the display screen. If you omit xpos, the distance is 0. If you specify xpos, you have to specify ypos as well.yposOptional. A numeric expression that specifies the vertical distance, in units of 1 pixel, between the top edge of the dialog box and the top edge of the screen. If you omit ypos, the distance is 0. If you specify ypos, you have to specify xpos as well.Return valueThe InputBox function returns a Variant containing a string. InputBox$ returns a String.UsageInputBox displays a dialog box with OK and Cancel buttons and a text entry field, interrupting execution of the script until the user confirms the text entry by clicking OK or Cancel. Then InputBox returns that entry. If the user clicks Cancel, InputBox returns the empty string (""). When the user clicks OK or Cancel, execution resumes.The Lotus product where you are running LotusScript may allow longer strings than described above for prompt, title, default, and the text entered into the text entry field. LotusScript will support longer strings for these items if the Lotus product does, up to 16000 characters.If you are using LotusScript from within Lotus Notes, note that the InputBox function writes to:A dialog box when executing on a Notes client. The user clicks OK, Cancel, Abort, Retry, Yes, or No to continue.NOTES.LOG when executing on a Domino server.[%sig%]
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:14
par Raziel
A part la fonction @prompt, tu n'a pas en 4.6, de fonction de permettant de reproduite la méthode prompt de la classe NotesuiWorkspace (version 5.x)L'une des solutions est de passer par un masque est une dialogbox par exemple.
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:17
par Raziel
Salut,Il ne me semble pas que le inputbox puisse répondre au pb car ce que veux laila c'est faire affiché une liste de fichiers possibles et que le user sélectionne celui qu'il souhaite ouvrir.Or, le inputbox ne permet pas l'affichage d'une liste en choix par défaut (uniquement une chaine de caractères)
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:20
par leila
En effet, Raziel vous avez bien compris ce que je veux faire!

Mais le probleme c'est que je ne sais pas du tout comment faire.....grrrrrren fait, si c'est pas possible d'afficher une liste de fichiers et de permettre a l'utilisateur de choisir, ce serait bien de pourvoir demander a l'utilisateur d'écrire lui meme le nom du fichier en question et que moi je le récupère pour lancer le programme avec ce nom en paramètre.
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:33
par Raziel
Rien ne t'empêche d'utliser le @prompt@Prompt ([OkCancelList];"Sélection d'un fichier";"Sélectionnez votre fichier";""; listeChoix )La problématique qu'il nous reste est de remplir ce champ listeChoix avec les noms de fichiers.Est ce que la liste de fichiers varie souvent où se sont tjs les mêmes ? Dans ce cas, tu peux, au démarrage de l'appli récupéré la liste des fichiers et la stocker dans un doc de profil. Ensuite, tu va récupéré cette liste et tu l'applique au @prompt.EX :dans ton script ou tu fait la récup des fichier (via la commande dir) tu rajoute les lignes suivantesdim session as new notessessiondim docProfil as notesdocumentdim db as notesdatabaseset db = session.currentdatabaseset docProfil = db.getprofiledocument("Administration", session.username)......docProfil.ListeNomsFichiers = "Tu met ici la liste des fichiers récupéré sours forme de tableau"docProfil.save true, trueEnsuite, dans le @prompt, tu fais ceci :listeChoix := @getprofilefield("Administration",ListeNomsFichiers);@Prompt ([OkCancelList];"Sélection d'un fichier";"Sélectionnez votre fichier";""; listeChoix )Je pense que ça devrait fonctionner
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 10:35
par Raziel
Oups petite erreurce n'est paslisteChoix := @getprofilefield("Administration",ListeNomsFichiers);maislisteChoix := @getprofilefield("Administration";ListeNomsFichiers;@username);
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 13:07
par leila
J'ai trouvé comment poser une question a l'utilisateur et passer en parametre la réponse obtenue, mais le probleme est le suivant:Je récupère un chemin d'acces au fichier.... puis lorsque je veux ouvrir le fichier je n'y arrive pas, le xlsObject.workbooks.Open nom_du_fichierne fonctionne pas!Comment je peux faire?
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 13:15
par Raziel
Est ce que tu lui donne bien toute la directory et pas seulement le nom du fichier ?La ligne suivante ouvre bien mon fichier :Workbooks.Open "C:\temp\Classeur2.xls"Est ce que tu as un message lors de l'éxécution ?
Re: affichage de question a l'ecran

Publié:
16 Juin 2003 à 13:32
par leila
Oui je lui donne bien toute la directory parce que en fait, je récupère le chemin d'accès en entier et je le range dans une variable que j'a nommé FichierSource, alors lorsque je lance le workbooks.Open FichierSource, ca plante! Pourquoi????? alors que si je tape le chemin d'acces ca marche.....