IonicWind Software

IWBasic => GUI Central => Topic started by: splakidas on March 19, 2007, 02:35:28 AM

Title: problem with multiline button
Post by: splakidas on March 19, 2007, 02:35:28 AM
this works ok i get a button with 3 lines

CONTROL hbot,@SYSBUTTON,"line1\nline2\nline3",0,128,64,64,0x50002000,5


this gives me one line  :-\ why ?

myline[1]="line1\nline2\nline3"
CONTROL hbot,@SYSBUTTON,myline[1],0,128,64,64,0x50002000,5
Title: Re: problem with multiline button
Post by: splakidas on March 19, 2007, 02:55:02 AM
i forgot to say that the problem is when i use

myline[1]="line1\nline2\nline3


this one works

myline="line1\nline2\nline3"


the problem is whith the array !!!!!!!!!!!
Title: Re: problem with multiline button
Post by: splakidas on March 19, 2007, 03:08:21 AM
To be more specific: I try to read the names for the buttons from a config file, and i want to have 3line buttons
Title: Re: problem with multiline button
Post by: Pip1957 on March 19, 2007, 04:04:47 AM
If using a dialog use the setcontroltext in @IDINITDIALOG to set the button text or if a window use setcontroltext in @IDCREATE
Title: Re: problem with multiline button
Post by: GJ on March 19, 2007, 06:05:30 AM
Still working here ...


CONST BUTTON_1 = 1
string myline[2]
myline[1]="line1\nline2\nline3"
DIALOG d1
CREATEDIALOG d1,0,0,300,202,0x80C80080,0,"Caption",&d1_handler

CONTROL d1,@SYSBUTTON,myline[1],65,49,70,64,0x50002000,BUTTON_1

domodal d1
end

SUB d1_handler
SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW d1
/* Initialize any controls here */
CASE @IDCLOSEWINDOW
CLOSEDIALOG d1,@IDOK
CASE @IDCONTROL
SELECT @CONTROLID
CASE BUTTON_1
IF @NOTIFYCODE = 0
/*button clicked*/
            CLOSEDIALOG d1
ENDIF
ENDSELECT
ENDSELECT
RETURN
ENDSUB


Using Windows XP home edition,


Gertjan
Title: Re: problem with multiline button
Post by: splakidas on March 19, 2007, 09:34:28 AM
GJ your code works but try to READ the text for your button from a text file ie:

CONST BUTTON_1 = 1
string myline[2]
rem myline[1]="line1\nline2\nline3"
DIALOG d1
file myfile

OPENFILE(myfile,"c://testfile.txt","r")
read (myfile,myline[1])
closefile myfile


CREATEDIALOG d1,0,0,300,202,0x80C80080,0,"Caption",&d1_handler

CONTROL d1,@SYSBUTTON,myline[1],65,49,70,64,0x50002000,BUTTON_1

domodal d1
end

SUB d1_handler
SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW d1
/* Initialize any controls here */
CASE @IDCLOSEWINDOW
CLOSEDIALOG d1,@IDOK
CASE @IDCONTROL
SELECT @CONTROLID
CASE BUTTON_1
IF @NOTIFYCODE = 0
/*button clicked*/
            CLOSEDIALOG d1
ENDIF
ENDSELECT
ENDSELECT
RETURN
ENDSUB


Thats same code as above but you have to create a file and read in the text for the button.
Title: Re: problem with multiline button
Post by: Ionic Wind Support Team on March 19, 2007, 09:57:45 AM
A newline character \n is a line terminator in an ASCII file.  So your READ statement will only read in the first line.

Use a binary file to store the information, or store some other character in place of the newline in the ASCII file and parse the line when you read it back.

Paul.
Title: Re: problem with multiline button
Post by: splakidas on March 19, 2007, 10:06:38 AM
Paul
thanks will change my code