FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
Global variables
Global variables
Débuté par Carlos SIlva, 29 sep. 2004 11:44 - 4 réponses
Connectez-vous…
Carlos SIlva
#1
Posté le 29 septembre 2004 - 11:44
Hello all.
I have simplified my code to 3 statements
//the first 2 are in the initialization for the project
GLOBAL
version_id_system is character
version_id_system = "ABC"
on any window that I launch I put a button and the code is:
Info(version_id_system)
I would expect the message window to display “ABC”
But it always shows “A” – The first and only character of the global variable content
What am I doing wrong? – Could someone please throw me a bone.
WD8 - WindowsXP SP2
Thanx
-carlos
Signaler
0
0
Clive Dickinson
#2
Posté le 29 septembre 2004 - 11:59
Carlos,
Try the line:
version_id_system is string
instead of:
version_id_system is character
hth,
Clive
Signaler
0
0
John Marrone
#3
Posté le 29 septembre 2004 - 14:02
Carlos
Character is 1 character, use string which is a string of characters.
version_id_system is string = "ABC"
Also you don't need the global statment. Anything you put in the the initialization for the project is global.
You can also declare the variable and assign it a value in one line of code as I have done above. HTH
John
Hello all.
I have simplified my code to 3 statements
//the first 2 are in the initialization for the project
GLOBAL
version_id_system is character
version_id_system = "ABC"
on any window that I launch I put a button and the code is:
Info(version_id_system)
I would expect the message window to display “ABC”
But it always shows “A” – The first and only character of the global variable content
What am I doing wrong? – Could someone please throw me a bone.
WD8 - WindowsXP SP2
Thanx
-carlos
Signaler
0
0
ion
#4
Posté le 23 décembre 2004 - 04:19
I want to write to a log file from many windows and when initializing and closing the project.
When I declare its handle "gLogID is int" in the Initialization of the project, it is not recognized by the Global procedures, for example
global procedure
PROCEDURE f_WriteToLog(sText)
IF gLogID <> -1 THEN
fWriteLine(gLogIDl,Today + " " + Left(Now,2) + ":" + Middle(Now,3,2) + ":" + Middle(Now,5,2) ...
+ " : " + sText)
END
does not recognize gLogID.
When I declare gLogID in the Global Procedures, then the project and the windows knowsnothing about it.
Is there any way to declare a very global variable or alternatively a very global procedure usable from everywhere?
Signaler
0
0
Raimund Schuldhaus
#5
Posté le 25 décembre 2004 - 18:30
Hello Ion,
that's cursios, for me and all of my apps I don't see such a behaviour. All things declared in the init of a project is visible/accessible
in the whole project.
Are you sure that the typo (gLogID1) in your example isn't the problem?
Regards
Raimund
In article <41ca20ed$1@news.pcsoft.fr>, Ion wrote:
I want to write to a log file from many windows and when initializing and closing the project.
When I declare its handle "gLogID is int" in the Initialization of the project, it is not recognized by the Global procedures, for example
global procedure
PROCEDURE f_WriteToLog(sText)
IF gLogID <> -1 THEN
fWriteLine(gLogIDl,Today + " " + Left(Now,2) + ":" + Middle(Now,3,2) + ":" + Middle(Now,5,2) ...
+ " : " + sText)
END
does not recognize gLogID.
When I declare gLogID in the Global Procedures, then the project and the windows knowsnothing about it.
Is there any way to declare a very global variable or alternatively a very global procedure usable from everywhere?
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte