IonicWind Software

IWBasic => General Questions => Topic started by: Andy on November 07, 2014, 12:18:42 AM

Title: Offset text position in a static control
Post by: Andy on November 07, 2014, 12:18:42 AM
Hi,

I have a static control, the text for it is simply a letter for example "A".
The static control size is 100 by 100.
The static has the colour white for the text and blue for the background.
The font size is 60.

Now, if I use
CONTROL w1,@STATIC,"A",10,10,100,100,@CTEDITLEFT, 1 - the text is on the very left hand side.

if I use:
CONTROL w1,@STATIC," A",10,10,100,100,@CTEDITLEFT, 1 - (with a space) - the "A" is too far over to the right.

Is there a way I can create a static control and specify the offset of the letter "A" - moving it to the right to a position that looks good to me, rather than just using @cteditleft/right/centre?

I don't want to draw a rectangle and use the print command.


DEF w1 as WINDOW

int blue   = rgb(0,148,196)
int white  = rgb(255,255,255)


OPENWINDOW w1,0,0,350,350,@MINBOX|@MAXBOX|@SIZE,0,"",&main

CONTROL w1,@STATIC,"A",10,10,100,100,@CTEDITLEFT, 1
SETCONTROLCOLOR w1, 1,white,blue
SETFONT w1,"Arial",60,700,0,1

WAITUNTIL w1 = 0
END


SUB main

    IF @CLASS = @IDCLOSEWINDOW
        CLOSEWINDOW w1

    ENDIF

RETURN
ENDSUB

Thanks,
Andy.




Title: Re: Offset text position in a static control
Post by: LarryMc on November 07, 2014, 01:20:25 AM
you'll have to subclass the control and draw it yourself in response to the
@IDPAINT message
Title: Re: Offset text position in a static control
Post by: LarryMc on November 07, 2014, 07:19:32 AM
Let me know if you need me to to write the code for you