### Oxygène++ Auto Instruction Example Source: https://www.memsoft.fr/aide/sdk/008.instructions/117.auto.htm This example demonstrates how to use the 'Auto' instruction to define a graphical menu that launches automatically when its associated DLL starts. Ensure the DLL has a .RUN or .IOX extension. ```Oxygene Objet MENUGRPH (Auto): MonMenuAutomatique "Menu Graphique démarrant automatiquement depuis une DLL" Declaration ECRAN : "MonEcran" FinDeclaration FinObjet ``` -------------------------------- ### Tabulation Method Example Source: https://www.memsoft.fr/aide/sdk/008.instructions/100.tabuler.htm This example demonstrates the setup for a TABULATION method, including defining operands to be edited and setting initial separators. ```ABAP Methode TABULATION Editer NOM,PRNOM Separateurs "G" FinMethode ``` -------------------------------- ### ImprimerTexte Instruction Example Source: https://www.memsoft.fr/aide/sdk/008.instructions/052.imprimertexte.htm This example demonstrates how to use the ImprimerTexte instruction to print a text string. It specifies alignment, line, column, height, width, style, and starting position within the string. If the text is truncated, it uses EtatPeriph to continue printing on a new page. ```Unknown Domaine : ESSAI "Impression d'un Texte" Objet IMPRESSION : IMPTXT Declaration PERIPH : ?,70,50 PARAMETRES : Chaine Texte("",250) VARIABLES : Double vpos = 0 FinDeclaration Methode FAIRE Page "H" **ImprimerTexte** Texte,"G",2,2,Hauteur-10,Largeur-4,"MG",vpos vpos = EtatPeriph Si vpos<>0 Alors Page "F" Continuer FinSi FinMethode FinObjet ``` -------------------------------- ### Using SePositionner to Guide Input Source: https://www.memsoft.fr/aide/sdk/008.instructions/111.sepositionner.htm This example demonstrates how to use SePositionner to automatically focus on a control if a specific condition is met. It's useful for guiding users to fill in required fields. ```Oxygene Declaration BASE : "GESCOM" TABLE : "GCPCLI" ECRAN : "GCPCLI" VARIABLES : Champ NAF,CAPITAL FinDeclaration Methode "NAF" Si NAF="" Alors SePositionner "NAF" FinSi FinMethode ``` -------------------------------- ### CreerContexteComposant Example Source: https://www.memsoft.fr/aide/sdk/001.programmation_composant/instructions_dediees_aux_composants/005.creercontextecomposant.htm This example demonstrates creating a new context for the ADRESSE component, named ADRESSE2, within the INIT method of the CLIENT component. ```Oxygene Objet GESTION : GESTION "Gestion des clients" Methode INIT CreerContexteComposant "ADRESSE","ADRESSE2" AppliquerDefaut FinMethode FinObjet ``` -------------------------------- ### Example 8: Starts With Filter with Sorting Source: https://www.memsoft.fr/aide/sdk/10_exploitation_de_la_base_de_donnees/les_cles_composees.htm Demonstrates a composite key for a 'Starts With' filter when sorting is applied to a different field. The sort field is placed first. ```text Filtre : Nom DebutePar "D", classé par Prénom Clé composée utilisable : Prénom ; … ``` -------------------------------- ### SQL Table Creation Example Source: https://www.memsoft.fr/aide/sdk/009.commandes_sql/acces_sql.htm Example SQL query to create a table compatible with Oxygène, including a counter field and indexes. ```sql CREATE TABLE [TEST4] ( OX_COMPTEUR int NOT NULL IDENTITY , TEST4_IDENT varchar (11) NULL DEFAULT '' , CHAMP1 smallint NULL DEFAULT 0 , CHAMP2 real NULL DEFAULT 0 , CHAMP3 float NULL DEFAULT 0 , CONSTRAINT PK_TEST4 PRIMARY KEY (OX_COMPTEUR)) /** Ajout des index **/ CREATE NONCLUSTERED INDEX IDX_TEST4_IDENT ON [TEST4] ( TEST4_IDENT,OX_COMPTEUR ) CREATE NONCLUSTERED INDEX IDX_TEST4_CODE ON [TEST4] ( CODE,OX_COMPTEUR ) ``` -------------------------------- ### PositionnerFin Instruction Example Source: https://www.memsoft.fr/aide/sdk/007.fonctions/055.positionnerfin.htm This example demonstrates how to use PositionnerFin to position at the end of the CLIENT table before iterating backwards to calculate a total. ```Oxygene Requete CLIENT.VILLE, EgalA "VERSAILLES" TantQue LireSuivant****(CLIENT) TVM=0 FinTantQue SuppFiltre CLIENT **PositionnerFin** CLIENT TantQue LirePrécédent****(CLIENT) total=total+TVM FinTantQue BoiteMessage "Nouveau total TVM" + total ``` -------------------------------- ### Complete Progress Bar Implementation Example Source: https://www.memsoft.fr/aide/sdk/11_exploitation_des_composants_systeme/jauge_de_progression.htm This code defines an object for managing a progress bar, including setup, updates, and cancellation handling. It's designed for scenarios with over 500 records to provide visual feedback during processing. ```VBNET Objet PARCOURS : PARCOURS_CLIENTS Declaration PARAMETRES : Entier Reference pAnnuleParUtilisateur // on retourne 1 si l'utilisateur abandonne Chaine pFiltreSQL // filtre récupéré d'un autre objet avec LitRequeteSql() VARIABLES : Entier vInstance("Instance de l'objet Progression") Entier vNbEnreg("Nombre d'enregistrements dans la table") Entier vCompteur("Compteur incrémenté à chaque enreg.") Entier vPourcent("Pourcentage de progression") FinDeclaration Methode DEBUT_TRI // si il y a un filtre, on l'applique Si pFiltreSQL="" Alors PoseRequeteSql TABLE, "Select * From TABLE "+pFiltreSQL FinSi AppliquerDefaut FinMethode Methode AVANT_DEBUT // -1 indique que la jauge n'a pas été créée vInstance = -1 // nombre d'enregistrements qu'on va parcourir Si pFiltreSQL="" Alors vNbEnreg = NbEnreg(TABLE) Sinon // la fonction NbEnreg() ne tient pas compte des filtres : nous devons calculer à la main PositionDebut TABLE TantQue LireSuivant(TABLE) Faire vNbEnreg = vNbEnreg + 1 FintantQue PositionDebut TABLE FinSi // on n'active la jauge que si il y a plus de 500 enregistrements Si vNbEnreg>500 Alors // création de la jauge CreerObjet OXYDEV."$$".PROGRESSION ("Titre de la fenêtre", CodeObjet, Instance) vInstance = InstanceCreee // changement des libellés AppliquerMethode OXYDEV."$$".PROGRESSION[vInstance].LIBELLE_CONTROLE ("LIB1", "Traitement des clients") AppliquerMethode OXYDEV."$$".PROGRESSION[vInstance].LIBELLE_CONTROLE ("LIB2", "Veuillez patienter ...") // afficher le bouton permettant d'annuler le traitement AppliquerMethode OXYDEV."$$".PROGRESSION[vInstance].ACTIVER_ANNULER (Vrai) FinSi AppliquerDefaut FinMethode Methode POUR_TOUT // Mettre ici votre traitement // ... // Gestion de la jauge de progression vCompteur = vCompteur+1 // On n'affiche la jauge que si le pourcentage a changé // pour éviter des milliers d'appels si il y a des milliers d'enregistrements Si vPourcent < Entier(vCompteur*100/vNbEnreg) alors vPourcent = vCompteur*100/vNbEnreg Si vInstance<>-1 Alors AppliquerMethode OXYDEV."$$".PROGRESSION[vInstance].AFFICHER_JAUGE (vPourcent) FinSi FinSi FinMethode // Evènement reçu par l'objet de jauge après un clic sur le bouton Annuler Methode PROGRESSION_ABAND //NettoyerMessage // peut être utile dans certains cas pAnnuleParUtilisateur = Vrai Sortir FinMethode Methode SORTIE // Sortie de la jauge si elle a été créée Si vInstance<>-1 Alors AppliquerMethode OXYDEV."$$".PROGRESSION[vInstance].SORTIE FinSi AppliquerDefaut FinMethode FinObjet ``` -------------------------------- ### Example: Client Table Reservation for Edition Source: https://www.memsoft.fr/aide/sdk/008.instructions/084.reserver.htm This example demonstrates a global reservation of the CLIENT table for an edition process. The table is reserved at the beginning of the process and released at the end. ```instruction Reserver CLIENT ``` ```instruction Liberer CLIENT ``` -------------------------------- ### Example: Using Curseur Instruction Source: https://www.memsoft.fr/aide/sdk/008.instructions/036.curseur.htm This example demonstrates how to set the cursor to an hourglass during a data processing loop and reset it to an arrow afterward. ```Oxygene Objet TRAITEMENT : INITTVM "Initialisation du montant des ventes" Declaration TABLE : CLIENT FinDeclaration Methode FAIRE Curseur 1 Positionner Debut CLIENT TantQue LireSuivant (CLIENT) TVM=0 FinTantQue Curseur 0 FinMethode FinObjet ``` -------------------------------- ### ModeVisu Instruction Example Source: https://www.memsoft.fr/aide/sdk/008.instructions/071.modevisu.htm This example demonstrates the usage of the ModeVisu instruction within a TRAITEMENT object's method to switch the ECRAN to visualization mode. ```ObjectScript Objet TRAITEMENT : MONTRAIT Declaration ECRAN : CLIECR FinDeclaration Methode DEBUT Lire NOM,Contient,"Media" FinMethode Methode JE_TESTE **ModeVisu** FinMethode FinObjet ``` -------------------------------- ### Example 7: Starts With Filter Source: https://www.memsoft.fr/aide/sdk/10_exploitation_de_la_base_de_donnees/les_cles_composees.htm Shows a composite key for a 'Starts With' filter. The field used in the 'Starts With' condition is placed first. ```text Filtre : Nom DebutePar "D" Clé composée utilisable : Nom ; … ``` -------------------------------- ### Launch NTBACKUP with WinExec Source: https://www.memsoft.fr/aide/sdk/007.fonctions/078.winexec.htm This example shows how to launch the NTBACKUP utility to perform a backup, with the window minimized. It includes error checking based on the return value of WinExec. ```Oxygene++ Methode NTBACKUP // lance une sauvegarde avec NTBACKUP (minimisé) Variables : Entier vresultat Chaine FICHIER_BKS = "C:\Documents\sauve.bks" Chaine NOM_BANDE = "QUOTIDIENNE" vresultat = ShellExecute ("ntbackup.exe backup "+FICHIER_BKS+" /j \"Sauve Serveur\" /t "+NOM_BANDE+" /a", SW_MINIMIZE) Si vresultat<=31 Alors BoiteMessage “Une erreur s'est produite lors de la sauvegarde de "+NOM_BANDE FinSi FinMethode ``` -------------------------------- ### Création et Initialisation du Serveur COM Oxygène++ Source: https://www.memsoft.fr/aide/sdk/012.exploitation_de_la_technologie_com/003.serveur_com/001.serveur_com.htm Demonstrates how to create an instance of the Oxygène++ COM server and initialize it with necessary parameters. ```APIDOC ## Création du serveur Oxygène++ Le ProgId de Oxygène++ est la chaîne de caractères suivante : « OxygenePlusPlus.Application ». Ainsi, la création de Oxygène++ en Visual Basic s'écrit comme ceci : ```vb Dim ObjetOxygenePlusPlus as Object 'Déclaration de l'objet Set ObjetOxygenePlusPlus = CreateObject("OxygenePlusPlus.Application") ``` ## Initialisation Lorsque Oxygène++ est lancé en mode serveur COM, il a besoin d'informations pour s'initialiser. Ces informations sont l'emplacement de la base de données (paramètre “d=”), le nom d'utilisateur (paramètre “u=”) et le nom de la société (paramètre “s=”). La méthode permettant de donner les informations de lancement a la signature suivante : ```cpp void Demarrer(const char far *repOxypp, const char far *utilisateur=0, const char far *societe = 0); ``` Elle peut donc être appelée de cette manière (en ASP, Visual Basic ou Visual Basic for Application (VBA)) : ```vb Retour = ObjetOxygenePlusPlus.Demarrer("c:\oxypp.400", "JEAN", "DEMO") ``` ``` -------------------------------- ### Méthode DEBUT avec requêtes de contexte Source: https://www.memsoft.fr/aide/sdk/10_exploitation_de_la_base_de_donnees/002.notion_de_contexte_de_table/001.notion_de_contextes_de_table.htm Définit les conditions initiales pour les contextes CONTEXTE1 et CONTEXTE2. Permet de filtrer les enregistrements affichés dans les listes dès le début du traitement. ```VBNET Methode DEBUT Requete CONTEXTE1.ETAT, EgalA, 1 Requete CONTEXTE2.ETAT, EgalA, 2 FinMethode ``` -------------------------------- ### Connect to COM Component Source: https://www.memsoft.fr/aide/sdk/012.exploitation_de_la_technologie_com/002.client_com/001.schema_general.htm Launches an instance of the server and connects to it. Use RattacherComposantCom if the server is already running. ```Oxygene ConnecterComposantCom ``` -------------------------------- ### PositionnerDebut Instruction Example Source: https://www.memsoft.fr/aide/sdk/007.fonctions/054.positionnerdebut.htm This example demonstrates how to use PositionnerDebut to iterate through a table and calculate a total. It first filters records by 'VERSAILLES' and then uses PositionnerDebut to start reading from the beginning of the filtered table. ```Oxygene Requete CLIENT.VILLE, EgalA "VERSAILLES" PositionnerDebut CLIENT TantQue LireSuivant(CLIENT) total=total+TVM FinTantQue BoiteMessage "Nouveau total "+total ``` -------------------------------- ### Get COM Constant Value with ValeurCom Source: https://www.memsoft.fr/aide/sdk/012.exploitation_de_la_technologie_com/002.client_com/010.valeurcom.htm Use ValeurCom to get the numerical value of a COM constant. This value can then be used as a parameter for COM methods. For example, retrieving the value of 'wdSendToNewDocument' to set the 'Destination' of a mail component. ```Oxygene AppliquerMethodeComposantComSet "MON_MAIL"."Destination" ( ValeurCom("MON_MAIL", "wdSendToNewDocument") ) ``` -------------------------------- ### SQL SELECT_COLUMNS Example Source: https://www.memsoft.fr/aide/sdk/009.commandes_sql/009.sql_select_columns.htm This example demonstrates connecting to an SQL server, selecting column information using SELECT_COLUMNS, and fetching the results. It includes error handling and displays the fetched column data. ```Oxygène++ Objet SAISIE :ODBC_COLONNE "Liste des colonnes" Declaration TABLE :SQLC ECRAN :COLUL MODES :V PARAMETRES: Chaine NOM_BASE("",64) Chaine USER("",64) Chaine PASSW("",64) Chaine CONT("",64) FinDeclaration Methode DEBUT Sql "CONNECT SERVER=\"" +NOM_BASE +"\";USER=" +USER +";PASSWORD=" +PASSW +";QUALIFIER=" +CONT Si SqlErreurNumero <>"" Alors BoiteMessage SqlErreurLibelle Sortir FinSi MajAuto SQLC ,0 Supprimer SQLC ** Sql "SELECT_COLUMNS TABLE_QUALIFIER[QUAL], TABLE_OWNER[OWNER]"** Si SqlErreurNumero <>"" Alors BoiteMessage SqlErreurLibelle Sortir FinSi TantQue SqlErreurNumero ="" Sql "FETCH" Si SqlErreurNumero ="" Alors Ecrire SQLC FinSi FinTantQue FinMethode Methode SORTIE Sql "DECONNECT" FinMethode FinObjet ``` -------------------------------- ### CreerObjet: Example with Parameters Source: https://www.memsoft.fr/aide/sdk/008.instructions/033.creerobjet.htm Demonstrates creating an object 'GR' which likely has a corresponding PARAMETRES declaration to handle potential formal variables. ```text CreerObjet GR ``` -------------------------------- ### Combine filters with OR operator Source: https://www.memsoft.fr/aide/sdk/008.instructions/047.filtre.htm Use the 'Ou' (OR) operator to include records that meet either of the specified conditions. This example filters by name starting with 'A'. ```STRUCTION Filtre(NOM, DebutePar, "A") ``` ```STRUCTION Ou(AGE, InferieurA, 40) ``` -------------------------------- ### Method Example: Using Codes Source: https://www.memsoft.fr/aide/sdk/expressions_operateurs_et_operandes/le_cas_particulier_des_codes.htm This example demonstrates various ways codes are used within a method, including direct display, hiding elements, making elements visible, and applying methods based on code values or string expressions. ```MEMSOFT Methode EXEMPLE "Utilisation des codes" Parametres: Chaine code_ecran="NOM" Variables: Chaine code_methode="PRIX_TTC", code_objet="LES_PRIX" Afficher ADRESSE // Affiche la zone d'écran "ADRESSE" Cacher AGE, "PRENOM" // Cache les zones d'écrans "AGE" et "PRENOM" RendreVisible code_ecran,PRENOM // Rends visibles les zones décrans "NOM" et "PRENOM" AppliquerMethode LES_TAXES.TAUX_TVA //Applique la méthode "TAUX_TVA" de l'objet "LES_TAXES" AppliqueMethode code_objet. code_methode //Applique la méthode "PRIX_TTC" de l'objet "LES_PRIX" AppliquerMethode code_objet.PRIX_HT //Applique la méthode "PRIX_HT" de l'objet "LES_PRIX" FinMethode ``` -------------------------------- ### Using the Entier Function Source: https://www.memsoft.fr/aide/sdk/007.fonctions/023.entier.htm This example demonstrates how to use the Entier function to get the integer part of a floating-point number. The result is displayed using BoiteMessage. ```Oxygene Objet TRAITEMENT : ENT1 Methode JE_TESTE BoiteMessage Entier (3.14159) FinMethode FinObjet ``` -------------------------------- ### SQL Connection and Data Fetching Example Source: https://www.memsoft.fr/aide/sdk/009.commandes_sql/005.sql_fetch.htm This example shows how to connect to an MS Access database, select all records from an ARTICLE table, and then fetch these records into an Oxygene table (ART) using a loop. It includes error handling for the SQL connection and fetch operations. ```Oxygene SQL "CONNECT Server=\"MS Access 2.0 Databases\", Qualifier=c:\\access\\gart.mdb" AppliquerMethode Sql_Error SQL "SELECT * FROM ARTICLE" AppliquerMethode Sql_Error Tantque SqlErreurNumero = "" //Commande SQL pour rapatrier dans la table OXYGENE les //enregistrements sélectionnés dans la base Access ** Sql "FETCH" ** Si SqlErreurNumero = "" Alors Ecrire ART Finsi FinTantQue ``` -------------------------------- ### Get Table Sharing Code with NomPartage Source: https://www.memsoft.fr/aide/sdk/007.fonctions/064.nompartage.htm Use NomPartage to retrieve the sharing code for a given table. This example demonstrates how to assign the result to a string variable. ```Oxygene Objet TRAITEMENT : TEST Declaration BASE :"TEST" TABLE_SECONDAIRE : "TEST"->TABLE_COURANTE FinDeclaration Methode "RECUPERE_NOM_PARTAGE" PARAMETRES : Chaine Reference vNomPartage vNomPartage=NomPartage “TEST” FinMethode ``` -------------------------------- ### Get Component Base Name Source: https://www.memsoft.fr/aide/sdk/007.fonctions/076.basecomposant.htm This example demonstrates how to use the BaseComposant function to retrieve and display the database name of a specified component. Ensure the component is connected before calling this function. ```Oxygene Methode "NOM_BASE" Variables : Chaine vcompo, vbase vcompo="GCPCLI" ConnecterComposant "GCPCLI" vbase=BaseComposant (vcompo) BoiteMessage "La base du composant "+vcompo+" est "+vbase FinMethode ``` -------------------------------- ### Get Current Database Name with NomBase Source: https://www.memsoft.fr/aide/sdk/007.fonctions/063.nombase.htm This example demonstrates how to retrieve the name of the current database using the NomBase function. It checks if the current database is 'TEST' and changes it if it's not. ```Oxygene Objet TRAITEMENT : TEST Declaration BASE :"TEST" TABLE_SECONDAIRE : "TEST"->TABLE_COURANTE FinDeclaration Methode "CHERCHE_BASE" VARIABLES : Chaine vBase VBase=NomBase TABLE_COURANTE Si vBase<> « TEST » Alors NomBase TABLE_COURANTE, « TEST » FinSi FinMethode ``` -------------------------------- ### Paramètres Supplémentaires pour l'Initialisation Source: https://www.memsoft.fr/aide/sdk/012.exploitation_de_la_technologie_com/003.serveur_com/001.serveur_com.htm Shows how to pass additional parameters, such as window title and other launch parameters, during the COM server initialization. ```APIDOC ## Paramètres supplémentaires Il est possible de renseigner des paramètres supplémentaires tels que le titre de la fenêtre (paramètre "t=") ainsi que tous les autres paramètres de lancement disponibles. Pour ce faire, il suffit de les envoyer à la suite du premier paramètre de la méthode Demarrer. Exemple d'appel Oxygène ++ en mode serveur (en ASP, Visual Basic, ou VBA) : ```vb Retour = ObjetOxygenePlusPlus.Demarrer("c:\oxypp.400 T=\"Oxygène ++\" BD=BDOXY,Mserveur","JEAN","DEMO") ``` Suite à cet appel, Oxygène sera lancé en tant que serveur COM, le titre de la fenêtre sera Oxygène++, et il sera lancé en mode client serveur en utilisant le serveur Mserveur. ``` -------------------------------- ### FTP Client Operations Example Source: https://www.memsoft.fr/aide/sdk/activex/activex_ftp.htm This example shows how to instantiate, connect, configure, and use the OxFtpClient ActiveX component for common FTP tasks. It includes error handling and status retrieval. ```WLanguage // connexion à l'ActiveX CreerContexteComposantCom "DNetHost.OxFtpClient","FTP" ConnecterComposantCom "FTP" // activation du journal si le fichier ftp.log existe Variables : Chaine vlog vlog = SGBDRep+"\ftp.log" Si ExisteFichier(vlog) Alors AppliquerMethodeComposantCom "FTP"."LogToFile" (vlog) FinSi // connexion au serveur AppliquerMethodeComposantCom "FTP"."SetConnection" (pServeur, pUtilisateur, pMotDePasse) // récupération du résultat (ou erreur) du dernier appel AppliquerMethodeComposantComGet "FTP"."LastError" (pMsg) // état : connecté ou non AppliquerMethodeComposantComGet "FTP"."Status" (vStatut) // capacités du serveur AppliquerMethodeComposantComGet "FTP"."Capabilities" (pCapabilities) // envoi d'un fichier AppliquerMethodeComposantCom "FTP"."Put" (pFichierSrc, pFichierDst) // récupération d'un fichier AppliquerMethodeComposantCom "FTP"."Get" (pFichierDst, pFichierSrc) // suppression d'un fichier AppliquerMethodeComposantCom "FTP"."DeleteFile" (pFichier) // suppression d'un répertoire AppliquerMethodeComposantCom "FTP"."DeleteRep" (pRep) // récupération de la liste des dossiers et fichiers d'un répertoire // le résultat se récupère avec LastError AppliquerMethodeComposantCom "FTP"."GetListing" (pRep) AppliquerMethodeComposantComGet "FTP"."LastError" (pListe) // déconnexion AppliquerMethodeComposantCom "FTP"."Disconnect" DeconnecterComposantCom "FTP" ``` -------------------------------- ### Combine filters with logical operators Source: https://www.memsoft.fr/aide/sdk/008.instructions/047.filtre.htm Combine multiple filters using 'Et' (AND) or 'Ou' (OR) operators for more refined data selection. This example filters by name starting with 'A' AND age less than 40. ```STRUCTION Filtre(NOM, DebutePar, "A") Et (AGE, InferieurA, 40) ``` -------------------------------- ### Example: Connecting and Disconnecting from SQL Server Source: https://www.memsoft.fr/aide/sdk/009.commandes_sql/002.sql_deconnect.htm This example shows how to establish a connection to an MS Access database using SQL CONNECT and then disconnect using SQL DECONNECT. It includes error checking after the connection attempt. ```Oxygene SQL "CONNECT Server=\"MS Access 2.0 Databases\", Qualifier=c:\\access\\ gart.mdb" //Vérification de la connexion Si SqlErreurNumero<>"" Alors BoiteMessage "Erreur sur Connect: "+SqlErreurLibelle Sortir FinSi ``` ```Oxygene SQL "DECONNECT" ``` -------------------------------- ### CodeAscii Function Example Source: https://www.memsoft.fr/aide/sdk/007.fonctions/072.codeascii.htm Demonstrates how to use the CodeAscii function to get the ASCII code of characters. It shows that only the first character of a string is processed if the input string has a length greater than 1. ```Oxygene Methode "TEST_ASCII" BoiteMessage "Code Ascii de A "+CodeAscii("A")+", CodeAscii b "+CodeAscii("b")+", Code Ascii de Ab "+CodeAscii("Ab") FinMethode ``` -------------------------------- ### Get Current Table Name - Oxygène++ Source: https://www.memsoft.fr/aide/sdk/007.fonctions/066.nomtable.htm This example demonstrates how to use the NomTable function to retrieve the name of the current table within a treatment object. Ensure the table is correctly referenced. ```Oxygene Objet TRAITEMENT : TEST Declaration BASE :"TEST" TABLE_SECONDAIRE : "TEST"->TABLE_COURANTE FinDeclaration Methode "RECUPERE_NOM_TABLE" PARAMETRES : Chaine Reference vNomTable vNomTable=NomTable TABLE_COURANTE FinMethode ``` -------------------------------- ### Complex filter with nested OR and AND Source: https://www.memsoft.fr/aide/sdk/008.instructions/047.filtre.htm Construct complex filter logic using nested parentheses with 'Ou' and 'Et' operators. This example filters by name starting with 'T' OR 'S', AND age between 20 and 40. ```STRUCTION Filtre((NOM, DebutePar, "T")Ou(NOM, DebutePar, "S")) Et(AGE, SuperieurA, 20) Et(AGE, InferieurA, 40) ``` -------------------------------- ### TRAITEMENT Object Example Source: https://www.memsoft.fr/aide/sdk/modeles_d_objet/modeles_de_base/modeles_de_traitement/002.traitement/modele_traitement.htm Demonstrates the basic structure of a TRAITEMENT object, including screen declaration and method chaining. ```VBNET Objet TRAITEMENT : TRT1 Declaration ECRAN : "ECR1" FinDeclaration Methode VALIDATION ChainerObjet TRT2 FinMethode FinObjet ``` -------------------------------- ### Pour...FinPour Loop Example Source: https://www.memsoft.fr/aide/sdk/008.instructions/075.pour_finpour.htm This example demonstrates a Pour loop that iterates from 0 up to (but not including) 20 with a step of 2, printing even numbers. Variables declared within the loop are local to it. ```MEMSOFT Domaine : ESSAI "Boucle Pour ... FinPour" Objet IMPRESSION : POURFINPOUR "Liste des nombres pairs" Declaration VARIABLES : Entier i("Indice de boucle") PERIPH : E FinDeclaration Methode JE_TESTE **Pour** i=0, i<20, 2 **Faire** Imprimer i Imprimer " est pair" Lignes **FinPour** FinMethode FinObjet ``` -------------------------------- ### Calculate Day Number with JDate Source: https://www.memsoft.fr/aide/sdk/007.fonctions/035.jdate.htm This example demonstrates how to use the JDate function to get the day number for a specific date. The function returns 0 for invalid dates, allowing for date validation. ```ABAP BoiteMessage "Le numéro de jour correspondant à la @date 01/03/1995 est:" +JDate("01031995") ``` -------------------------------- ### Using LibelleControle to Get a List's Title Source: https://www.memsoft.fr/aide/sdk/007.fonctions/038.libellecontrole.htm This example demonstrates how to use LibelleControle to retrieve and display the title of a list control named 'LST'. The function can only be used within objects declared with ECRAN. ```Oxygene BoiteMessage "Le titre de la liste @est : "+LibelleControle ("LST") ``` -------------------------------- ### Example 1: Simple Equality Filters Source: https://www.memsoft.fr/aide/sdk/10_exploitation_de_la_base_de_donnees/les_cles_composees.htm Demonstrates composite keys for filters with only equality conditions. Fields with equality conditions should appear first in the composite key. ```text Filtre : Nom = "Dupont" Et Prénom = "Jean" Clés composées utilisables : Nom ; Prénom Prénom ; Nom Nom ; Prénom ; Age Nom ; Prénom ; Age ; Adresse ; … Clés composée inutilisable : Age ; Nom ; Prénom Clé composée non conseillée car non optimale : Nom Prénom ``` -------------------------------- ### Find Last Occurrence of Character - Oxygene++ Source: https://www.memsoft.fr/aide/sdk/007.fonctions/052.position.htm This example shows how to find the last occurrence of a character (a backslash) in a string by repeatedly using the Position function with an incrementing start position. It then extracts the substring after the last backslash. ```Oxygene++ Variables : Entier pos, pos_tmp Chaine rep // par exemple = "D:\\oxygene\\oxypp\\gescom" Chaine sous_rep pos = Position("\\", rep) TantQue pos > 0 Faire pos_tmp = pos pos = Position("\\", rep, pos_tmp+1) FinTantQue sous_rep = Extrait(rep, pos+1, 0) // résultat : sous_rep = "gescom" ``` -------------------------------- ### Oxygène++ Source File Structure Example Source: https://www.memsoft.fr/aide/sdk/langage_oxygene.htm This example demonstrates the basic structure of an Oxygène++ source file, including component, object, declaration, and method definitions. It shows how to interact with database tables and screens, and includes conditional logic within a method. ```Oxygène++ Composant CLIENT Objet GESTION_LISTE : GESTION Declaration BASE : GESCOM TABLE : CLIENT ECRAN : GESTION.ECR FinDeclaration Methode DEBUT_FICHE AppliquerDefaut Si CLIENT.ENCOURS>10000 Alors BoiteMessage "Attention, le client "+CLIENT.DESIG+" possède un encours supérieur à 1000€" FinSi FinMethode FinObjet ``` -------------------------------- ### Get Unique Key and Reposition Record with LireCleUnique Source: https://www.memsoft.fr/aide/sdk/008.instructions/061.lirecleunique.htm This example demonstrates how to obtain a unique key for a record using CleUnique and then reposition to that record using LireCleUnique. It also shows how to check the table status after the operation using EtatTable. ```Memsoft Methode JE_TESTE Si Lire(CLIENT2.NO, EgalA, "12") Alors numcle=CleUnique(CLIENT2) FinSi FinMethode Methode VALIDATION LireCleUnique(CLIENT2,numcle) Si EtatTable(CLIENT2)=2 Alors BoiteMessage "Mise à jour impossible!" Sinon TVM=TVM+100 FinSi FinMethode ``` -------------------------------- ### Launch Word using WinExec Source: https://www.memsoft.fr/aide/sdk/007.fonctions/078.winexec.htm This example demonstrates how to open Microsoft Word using the WinExec function. It checks the return value to handle potential errors like an incorrect path or general execution failures. ```Oxygene++ Methode "JE_LANCE_WORD" //Ouvre Word Variables : Entier vresultat vresultat = WinExec ("open","C:\Program Files\Microsoft Office\OFFICE11\winword.exe",SW_SHOW) Si vresultat=3 Alors BoiteMessage “Le chemin de MS Word est incorrect"+ SinonSi vresultat<=31 Alors BoiteMessage “ Une erreur s'est produite lors de l'ouverture de Word” FinSi FinMethode ``` -------------------------------- ### Get Unique Record Number with CleUnique Source: https://www.memsoft.fr/aide/sdk/007.fonctions/015.cleunique.htm This example demonstrates how to use the CleUnique function to retrieve the unique identifier of the last record in a table. Ensure the table is declared and that LireDernier is used to position to the last record before calling CleUnique. ```Oxygène++ Domaine ESSAI Objet TRAITEMENT : CLEUNIQUE Declaration TABLE : REPR VARIABLES : Entier numer("Numéro d'enregistrement") FinDeclaration Methode JE_TESTE Si LireDernier (REPR) Alors numer = CleUnique (REPR) BoiteMessage "Numéro du dernier enregistrement: "+numer FinSi FinMethode FinObjet ``` -------------------------------- ### Get Variable Code of a Screen Control Source: https://www.memsoft.fr/aide/sdk/007.fonctions/061.variablecontrole.htm This example demonstrates how to use VariableControle to retrieve the variable code of a specific screen control (CDNOM) and display it in a message box. Ensure the object has an ECRAN declaration and the control has a defined variable property. ```Oxygene DOMAINE : ESSAI Objet SAISIE : MDCOM Declaration ECRAN : CLIECR FinDeclaration Methode JE_TESTE BoiteMessage "Le code de la variable de la @zone CDNOM est"+ VariableControle("CDNOM") FinMethode FinObjet ``` -------------------------------- ### ImprimerFichier Instruction Example Source: https://www.memsoft.fr/aide/sdk/008.instructions/050.imprimerfichier.htm This example demonstrates how to use the ImprimerFichier instruction to print the content of a file. It specifies the file path, alignment, position, dimensions, style, and initial print position. It also shows how to check the EtatPeriph variable to continue printing if the content was truncated. ```BASIC Domaine : ESSAI "Edition d'un Fichier" Objet IMPRESSION : IMPFIC Declaration PERIPH : ?,70,50 VARIABLES : Double vpos = 0 FinDeclaration Methode FAIRE Page "H" **ImprimerFichier** "C:\\WINDOWS\\WIN.INI", "G",2,2,Hauteur-10,Largeur-4,"MG",vpos vpos = EtatPeriph Si vpos<>0 Alors Page "F" Continuer FinSi FinMethode FinObjet ``` -------------------------------- ### Using ExtensionControle to Get Control Extension Value Source: https://www.memsoft.fr/aide/sdk/007.fonctions/027.extensioncontrole.htm This example demonstrates how to use the ExtensionControle function to retrieve the value of a specific extension ('CodeListe') from the current screen. It then displays this value in a message box. The first parameter is an empty string, indicating the default screen should be used. ```Oxygène++ Chaine CodeCtrl("Code du contrôle",15) Methode LIBEL CodeCtrl = ExtensionControle("","CodeListe") BoiteMessage"La valeur de l'extension CodeListe de l'écran est "+CodeCtrl FinMethode ``` -------------------------------- ### Rechercher Instruction Example Source: https://www.memsoft.fr/aide/sdk/008.instructions/079.rechercher.htm This example demonstrates how to use the Rechercher instruction to find a client record by name in either visualization or modification mode. After searching, it applies the appropriate method (DEBUT_VISUALISATION or DEBUT_MODIFICATION) and displays the result. ```VBNET Si Mode="V" Alors **Rechercher** CLIENT.NOM, EgalA, nouvcli AppliquerMethode DEBUT_VISUALISATION Afficher SinonSi Mode="M" Et Saisie=0 Alors **Rechercher** CLIENT.NOM, EgalA, nouvcli AppliquerMethode DEBUT_MODIFICATION Afficher FinSi ``` -------------------------------- ### Calculate Last Day of Month using FinMois Source: https://www.memsoft.fr/aide/sdk/007.fonctions/029.finmois.htm This example demonstrates how to use the FinMois function to find the last day of a month. It uses JDate to get the day number of a specific date and then FinMois to calculate the last day of that month. The result is displayed using EDate and DJour. ```Oxygene Domaine : ESSAI "Calcul de la date de fin de mois" Objet TRAITEMENT : FCTFM Methode JE_TESTE BoiteMessage "Le dernier jour du mois de Février 1996 @(de numéro"+ FinMois(JDate("140296"))+ " est le "+EDate(DJour(FinMois(JDate("140296"))),"/") FinMethode FinObjet ```