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
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 !!!!!!!!!!!
To be more specific: I try to read the names for the buttons from a config file, and i want to have 3line buttons
If using a dialog use the setcontroltext in @IDINITDIALOG to set the button text or if a window use setcontroltext in @IDCREATE
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
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.
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.
Paul
thanks will change my code