banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

Annonce

GEODATA DAYS 2024

#1 Mon 04 October 2010 12:14

ebiseau
Participant actif
Date d'inscription: 6 Sep 2010
Messages: 98

Map Basic - Modifier une mise en page

Bonjour,

je souhaite écrire du texte dans une mise en page existante.

J'ai écrit ce mbx :

Include "mapbasic.def"
Declare sub main

sub main
set layout window WindowID(5)
  Create Text
    ReadcontrolValue(1)
    (0.9132,0.9146) (3.0701,1.0729)
    Font ("Arial",0,10,0)
end sub

Le mbx s'exécute bien mais rien ne se passe...

Savez vous comment je dois m'y prendre ?

merci :-)

Hors ligne

 

#2 Mon 04 October 2010 12:24

Maurice
Membre
Lieu: Montpellier
Date d'inscription: 5 Sep 2005
Messages: 5331

Re: Map Basic - Modifier une mise en page

Bonjour
Utilisez la commande Create Text....

Hors ligne

 

#3 Mon 04 October 2010 13:51

ebiseau
Participant actif
Date d'inscription: 6 Sep 2010
Messages: 98

Re: Map Basic - Modifier une mise en page

La commande Create text, je l'utilise dans mon mbx

Hors ligne

 

#4 Mon 04 October 2010 14:45

Maurice
Membre
Lieu: Montpellier
Date d'inscription: 5 Sep 2005
Messages: 5331

Re: Map Basic - Modifier une mise en page

Je ne parle pas de l'instruction, mais de la commande.
Celle là, telle qu'elle figure dans l'aide:

Purpose

Creates a text object, such as a title, for a Map or Layout window.

Syntax

Create Text
    [  Into  { Window  window_id  |  Variable  var_name }  ]
     text_string 
    ( x1, y1 )  ( x2, y2 ) 
    [ Font  . . . ]
    [ Label Line { Simple | Arrow }  (  label_x ,  label_y )  ]
    [ Spacing  { 1.0 | 1.5 | 2.0 }  ]
    [ Justify  { Left | Center | Right }  ]
    [ Angle  text_angle  ]

window_id  is an Integer window ID number, identifying a Map or Layout window
var_name  is the name of an existing object variable
text_string  specifies the string, up to 255 characters long, that will constitute the text object; to create a multiple-line text object, embed the function call Chr$(10) in the string
x1 , y1  are floating-point coordinates, specifying one corner of the rectangular area which the text will fill
x2 , y2  specify the opposite corner of the rectangular area which the text will fill

The Font clause specifies a text style. The point-size element of the Font is ignored if the text object is created in a Map window; see below.
label_x , label_y  specifies the position where the text object's label line is anchored
text_angle  is a Float value indicating the angle of rotation for the text object (in degrees)

Description

The x and y parameters use whatever coordinate system MapBasic is currently using. By default, MapBasic uses a longitude, latitude coordinate system, although the Set CoordSys statement can re-configure MapBasic to use a different coordinate system. If you need to create objects on a Layout window, you must first issue a Set CoordSys Layout statement.
The x1, y1, x2, and y2 arguments define a rectangular area. When you create text in a Map window, the text fills the rectangular area, which controls the text height; the point size specified in the Font clause is ignored. In a Layout window, text is drawn at the point size specified in the Font clause, with the upper-left corner of the text placed at the (x1, y1) location; the (x2, y2) arguments are ignored.

Hors ligne

 

#5 Mon 04 October 2010 15:17

ebiseau
Participant actif
Date d'inscription: 6 Sep 2010
Messages: 98

Re: Map Basic - Modifier une mise en page

Merci :-)
Dernière question que dois je mettre comme Variable (var_name) ?

Hors ligne

 

#6 Mon 04 October 2010 15:43

ebiseau
Participant actif
Date d'inscription: 6 Sep 2010
Messages: 98

Re: Map Basic - Modifier une mise en page

Excuse j'ai réussi mais toujours rien à l'écran ne s'affiche :
sub main
Create Text
Into  Window windowid(5)
"ceci est un test"
(0.9132,0.9146) (3.0701,1.0729)
Font ("Arial",0,10,0)
Label Line Simple (0.9132,0.9146 )
Spacing  1.0
Justify Left
Angle 0

end sub

Hors ligne

 

#7 Mon 04 October 2010 15:50

Maurice
Membre
Lieu: Montpellier
Date d'inscription: 5 Sep 2005
Messages: 5331

Re: Map Basic - Modifier une mise en page

Attention à lire attentivement l'aide...malheureusement pas en français sad
[  Into  { Window  window_id  |  Variable  var_name }  ]  veut dire soit Into Window... soit Into Variable...
Notez aussi la phrase: " If you need to create objects on a Layout window, you must first issue a Set CoordSys Layout statement. "
Il faut que MI comprenne en quelles unités sont exprimées les coordonnées x1, y1  (qui sont les seules utiles pour une mise en page: "In a Layout window, text is drawn at the point size specified in the Font clause, with the upper-left corner of the text placed at the (x1, y1) location; the (x2, y2) arguments are ignored.")

Hors ligne

 

#8 Mon 04 October 2010 15:56

ebiseau
Participant actif
Date d'inscription: 6 Sep 2010
Messages: 98

Re: Map Basic - Modifier une mise en page

ok, merci pour tout :-) j'ai rajouté le système de coordonnées et cela fonctionne.

merci Maurice

Hors ligne

 

Pied de page des forums

Powered by FluxBB