October 28, 2025, 11:19:41 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


problem with multiline button

Started by splakidas, March 19, 2007, 02:35:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

splakidas

March 19, 2007, 02:35:28 AM Last Edit: March 19, 2007, 02:56:43 AM by splakidas
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

splakidas

March 19, 2007, 02:55:02 AM #1 Last Edit: March 19, 2007, 02:57:13 AM by splakidas
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 !!!!!!!!!!!

splakidas

To be more specific: I try to read the names for the buttons from a config file, and i want to have 3line buttons

Pip1957

If using a dialog use the setcontroltext in @IDINITDIALOG to set the button text or if a window use setcontroltext in @IDCREATE

GJ

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

splakidas

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.

Ionic Wind Support Team

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.
Ionic Wind Support Team

splakidas