From gambas at ...1... Sun Aug 1 02:11:32 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 1 Aug 2010 02:11:32 +0200 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 Message-ID: <201008010211.32694.gambas@...1...> Hi, As the subject said, I have disabled DatePicker and MessageLabel in the gb.form component, to see if someone use them. These controls have problems, especially the DatePicker, and if their creator want to fix them, they should tell me. Otherwise they may be removed, or rewritten if I have time and someone really needs them. In the same revision, you can add close buttons to TabStrip tabs, as someone asked recently. Regards, -- Beno?t Minisini From prog at ...2177... Sun Aug 1 02:57:56 2010 From: prog at ...2177... (craf) Date: Sat, 31 Jul 2010 20:57:56 -0400 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 In-Reply-To: <201008010211.32694.gambas@...1...> References: <201008010211.32694.gambas@...1...> Message-ID: <1280624276.2510.3.camel@...2406...> button to close would be great. Thank you very much Regards >-----Mensaje original----- >De: Beno?t Minisini >Reply-to: mailing list for gambas users >Para: gambas-user at lists.sourceforge.net >Asunto: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 >Fecha: Sun, 1 Aug 2010 02:11:32 +0200 >Hi, >As the subject said, I have disabled DatePicker and MessageLabel in the >gb.form component, to see if someone use them. >These controls have problems, especially the DatePicker, and if their creator >want to fix them, they should tell me. Otherwise they may be removed, or >rewritten if I have time and someone really needs them. >In the same revision, you can add close buttons to TabStrip tabs, as someone >asked recently. >Regards, From david.villalobos.c at ...626... Sun Aug 1 03:59:26 2010 From: david.villalobos.c at ...626... (David Villalobos Cambronero) Date: Sat, 31 Jul 2010 19:59:26 -0600 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 In-Reply-To: <201008010211.32694.gambas@...1...> References: <201008010211.32694.gambas@...1...> Message-ID: Hi all, I wrote MessageLabel, if some people use it, I'll fix it, otherwise just delete it. Regards --- David 2010/7/31 Beno?t Minisini : > Hi, > > As the subject said, I have disabled DatePicker and MessageLabel in the > gb.form component, to see if someone use them. > > These controls have problems, especially the DatePicker, and if their creator > want to fix them, they should tell me. Otherwise they may be removed, or > rewritten if I have time and someone really needs them. > > In the same revision, you can add close buttons to TabStrip tabs, as someone > asked recently. > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From rterry at ...1946... Sun Aug 1 10:31:54 2010 From: rterry at ...1946... (richard terry) Date: Sun, 1 Aug 2010 18:31:54 +1000 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 In-Reply-To: <201008010211.32694.gambas@...1...> References: <201008010211.32694.gambas@...1...> Message-ID: <201008011831.54710.rterry@...1946...> Hi Benoit Is DatePicker, the same as DateChooser - if so I use it all the time so I'd hate to see it deleted. Regards Richard On Sunday 01 August 2010 10:11:32 Beno?t Minisini wrote: > Hi, > > As the subject said, I have disabled DatePicker and MessageLabel in the > gb.form component, to see if someone use them. > > These controls have problems, especially the DatePicker, and if their > creator want to fix them, they should tell me. Otherwise they may be > removed, or rewritten if I have time and someone really needs them. > > In the same revision, you can add close buttons to TabStrip tabs, as > someone asked recently. > > Regards, > From oceanosoftlapalma at ...626... Sun Aug 1 11:09:57 2010 From: oceanosoftlapalma at ...626... (=?ISO-8859-1?Q?Ricardo_D=EDaz_Mart=EDn?=) Date: Sun, 1 Aug 2010 11:09:57 +0200 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 In-Reply-To: <201008011831.54710.rterry@...1946...> References: <201008010211.32694.gambas@...1...> <201008011831.54710.rterry@...1946...> Message-ID: It's not the same Richard. DataPicker is only present on gambas3 as an user control. Regards, Ricardo D?az 2010/8/1 richard terry > Hi Benoit > > Is DatePicker, the same as DateChooser - if so I use it all the time so > I'd > hate to see it deleted. > > Regards > > Richard > > On Sunday 01 August 2010 10:11:32 Beno?t Minisini wrote: > > Hi, > > > > As the subject said, I have disabled DatePicker and MessageLabel in the > > gb.form component, to see if someone use them. > > > > These controls have problems, especially the DatePicker, and if their > > creator want to fix them, they should tell me. Otherwise they may be > > removed, or rewritten if I have time and someone really needs them. > > > > In the same revision, you can add close buttons to TabStrip tabs, as > > someone asked recently. > > > > Regards, > > > > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From ea7dfh at ...2382... Sun Aug 1 16:30:28 2010 From: ea7dfh at ...2382... (EA7DFH) Date: Sun, 01 Aug 2010 16:30:28 +0200 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 In-Reply-To: <201008010211.32694.gambas@...1...> References: <201008010211.32694.gambas@...1...> Message-ID: <4C558504.3090200@...2382...> El 01/08/10 02:11, Beno?t Minisini escribi?: > Hi, > > As the subject said, I have disabled DatePicker and MessageLabel in the > gb.form component, to see if someone use them. > > These controls have problems, especially the DatePicker, and if their creator > want to fix them, they should tell me. Otherwise they may be removed, or > rewritten if I have time and someone really needs them. > > In the same revision, you can add close buttons to TabStrip tabs, as someone > asked recently. > > Regards, > > I use a custom DatePicker (based on DateChooser) extensively in my applications in Gambas2, I don't want it to disappear as a control when I begin migrating to Gambas3, as it saves a lot of code and it's a handsome control. So, please do not remove it... ;-) -- Jesus, EA7DFH From gambas at ...1... Sun Aug 1 16:37:16 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 1 Aug 2010 16:37:16 +0200 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 In-Reply-To: <4C558504.3090200@...2382...> References: <201008010211.32694.gambas@...1...> <4C558504.3090200@...2382...> Message-ID: <201008011637.16423.gambas@...1...> > El 01/08/10 02:11, Beno?t Minisini escribi?: > > Hi, > > > > As the subject said, I have disabled DatePicker and MessageLabel in the > > gb.form component, to see if someone use them. > > > > These controls have problems, especially the DatePicker, and if their > > creator want to fix them, they should tell me. Otherwise they may be > > removed, or rewritten if I have time and someone really needs them. > > > > In the same revision, you can add close buttons to TabStrip tabs, as > > someone asked recently. > > > > Regards, > > I use a custom DatePicker (based on DateChooser) extensively in my > applications in Gambas2, I don't want it to disappear as a control when > I begin migrating to Gambas3, as it saves a lot of code and it's a > handsome control. > > So, please do not remove it... ;-) The DatePicker has many problems, so something must be done! -- Beno?t Minisini From prog at ...2177... Sun Aug 1 19:21:24 2010 From: prog at ...2177... (craf) Date: Sun, 01 Aug 2010 13:21:24 -0400 Subject: [Gambas-user] Problem with ComboBox Message-ID: <1280683284.4461.10.camel@...2406...> Hi. 1.Objective-----: *Select an item from a ComboBox control and execute an action on your Change event 2.Actions-------: *Load the ComboBox with the elements "1" and "2" *Create a message in the Change event of the ComboBox: PRIVATE ComboBox1_Change() Message("There was a change in the text") END *Run the program and select the first item in the ComboBox 3.Problem--------: By selecting the first element of the ComboBox does not run the Change event only when you click the second item. Then, as you can click the first item. OS: Ubuntu 9.10 Gambas: 2.21.0 Desktop : Gnome Regards From gambas at ...1... Sun Aug 1 19:37:17 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 1 Aug 2010 19:37:17 +0200 Subject: [Gambas-user] Problem with ComboBox In-Reply-To: <1280683284.4461.10.camel@...2406...> References: <1280683284.4461.10.camel@...2406...> Message-ID: <201008011937.17841.gambas@...1...> > Hi. > > 1.Objective-----: > > *Select an item from a ComboBox control and execute an action on your > Change event > > 2.Actions-------: > > *Load the ComboBox with the elements "1" and "2" > > *Create a message in the Change event of the ComboBox: > PRIVATE ComboBox1_Change() > Message("There was a change in the text") > END > *Run the program and select the first item in the ComboBox > > > 3.Problem--------: > > By selecting the first element of the ComboBox does not run the Change > event only when you click the second item. Then, as you can click the > first item. > > > OS: Ubuntu 9.10 > Gambas: 2.21.0 > Desktop : Gnome > > Regards > > Can you try the latest svn revision? I have fixed some bugs in the ComboBox control. Regards, -- Beno?t Minisini From gambas at ...1... Sun Aug 1 19:44:09 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 1 Aug 2010 19:44:09 +0200 Subject: [Gambas-user] Problem with ComboBox In-Reply-To: <201008011937.17841.gambas@...1...> References: <1280683284.4461.10.camel@...2406...> <201008011937.17841.gambas@...1...> Message-ID: <201008011944.09386.gambas@...1...> > > Hi. > > > > 1.Objective-----: > > > > *Select an item from a ComboBox control and execute an action on your > > Change event > > > > 2.Actions-------: > > > > *Load the ComboBox with the elements "1" and "2" > > > > *Create a message in the Change event of the ComboBox: > > PRIVATE ComboBox1_Change() > > Message("There was a change in the text") > > END > > *Run the program and select the first item in the ComboBox > > > > > > 3.Problem--------: > > > > By selecting the first element of the ComboBox does not run the Change > > event only when you click the second item. Then, as you can click the > > first item. > > > > > > OS: Ubuntu 9.10 > > Gambas: 2.21.0 > > Desktop : Gnome > > > > Regards > > Can you try the latest svn revision? I have fixed some bugs in the ComboBox > control. > > Regards, Mmm. And do not forget that the Change event is raised only if ReadOnly is False. Otherwise you must use the Click event. Regards, -- Beno?t Minisini From gambas at ...1... Sun Aug 1 20:51:42 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 1 Aug 2010 20:51:42 +0200 Subject: [Gambas-user] Bug in gb3: save as In-Reply-To: <4C547DBF.8050302@...221...> References: <4C5451D2.20902@...221...> <201007312037.46755.gambas@...1...> <4C547DBF.8050302@...221...> Message-ID: <201008012051.42564.gambas@...1...> > You're welcome. Never mind, you must have tons of forgettable things... :-) > Indeed :-). Anyway, the bug has been fixed in revision #3085. Regards, -- Beno?t Minisini From gambas at ...1... Sun Aug 1 20:53:14 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 1 Aug 2010 20:53:14 +0200 Subject: [Gambas-user] signal#11 in Gambas3 In-Reply-To: <4C541448.4030306@...221...> References: <4C541448.4030306@...221...> Message-ID: <201008012053.14745.gambas@...1...> > Hi, > > I have a dialog right at the start of a program, and if the user aborts the > dialog, the program should quit. > > In gambas2 this worked: > If Dialog.SelectDirectory() Then > Quit > Endif > > In gambas3 (v 3083) I get the signal#11 (for the program, not for gambas > itself) at this point. > Also tried Me.Close, with same result. > Is there a new way to close an app, or is it a bug? > > Thanks > Matti > I need your project and a way to reproduce the bug. At least backtraces, as explained in the "Reporting a problem" page on the website. Note that the Quit instruction is not safe in GUI program. But the Me.Close() must not crash at all, or it is a bug! Regards, -- Beno?t Minisini From math.eber at ...221... Sun Aug 1 21:56:41 2010 From: math.eber at ...221... (Matti) Date: Sun, 01 Aug 2010 21:56:41 +0200 Subject: [Gambas-user] signal#11 in Gambas3 In-Reply-To: <201008012053.14745.gambas@...1...> References: <4C541448.4030306@...221...> <201008012053.14745.gambas@...1...> Message-ID: <4C55D179.5010707@...221...> Sorry, I think this was my fault. For reasons I don't remember anymore, I had this dialog in the _new() routine. Put it into Form_Open(), and everything is fine. Am 01.08.2010 20:53, schrieb Beno?t Minisini: >> Hi, >> >> I have a dialog right at the start of a program, and if the user aborts the >> dialog, the program should quit. >> >> In gambas2 this worked: >> If Dialog.SelectDirectory() Then >> Quit >> Endif >> >> In gambas3 (v 3083) I get the signal#11 (for the program, not for gambas >> itself) at this point. >> Also tried Me.Close, with same result. >> Is there a new way to close an app, or is it a bug? >> >> Thanks >> Matti >> > > I need your project and a way to reproduce the bug. At least backtraces, as > explained in the "Reporting a problem" page on the website. > > Note that the Quit instruction is not safe in GUI program. But the Me.Close() > must not crash at all, or it is a bug! > > Regards, > From gambas at ...1... Sun Aug 1 22:00:59 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 1 Aug 2010 22:00:59 +0200 Subject: [Gambas-user] signal#11 in Gambas3 In-Reply-To: <4C55D179.5010707@...221...> References: <4C541448.4030306@...221...> <201008012053.14745.gambas@...1...> <4C55D179.5010707@...221...> Message-ID: <201008012200.59844.gambas@...1...> > Sorry, I think this was my fault. > For reasons I don't remember anymore, I had this dialog in the _new() > routine. Put it into Form_Open(), and everything is fine. > No, it's not your fault if you have a crash. And if you give me a way to reproduce it, I will able to fix it. -- Beno?t Minisini From prog at ...2177... Sun Aug 1 23:34:13 2010 From: prog at ...2177... (craf) Date: Sun, 01 Aug 2010 17:34:13 -0400 Subject: [Gambas-user] Problem with ComboBox In-Reply-To: <201008011944.09386.gambas@...1...> References: <1280683284.4461.10.camel@...2406...> <201008011937.17841.gambas@...1...> <201008011944.09386.gambas@...1...> Message-ID: <1280698453.2585.0.camel@...2406...> -----Mensaje original----- De: Beno?t Minisini Reply-to: mailing list for gambas users Para: mailing list for gambas users Asunto: Re: [Gambas-user] Problem with ComboBox Fecha: Sun, 1 Aug 2010 19:44:09 +0200 > > Hi. > > > > 1.Objective-----: > > > > *Select an item from a ComboBox control and execute an action on your > > Change event > > > > 2.Actions-------: > > > > *Load the ComboBox with the elements "1" and "2" > > > > *Create a message in the Change event of the ComboBox: > > PRIVATE ComboBox1_Change() > > Message("There was a change in the text") > > END > > *Run the program and select the first item in the ComboBox > > > > > > 3.Problem--------: > > > > By selecting the first element of the ComboBox does not run the Change > > event only when you click the second item. Then, as you can click the > > first item. > > > > > > OS: Ubuntu 9.10 > > Gambas: 2.21.0 > > Desktop : Gnome > > > > Regards > > Can you try the latest svn revision? I have fixed some bugs in the ComboBox > control. > > Regards, Mmm. And do not forget that the Change event is raised only if ReadOnly is False. Otherwise you must use the Click event. Regards, Ok. Thank you Regards From math.eber at ...221... Mon Aug 2 09:09:59 2010 From: math.eber at ...221... (Matti) Date: Mon, 02 Aug 2010 09:09:59 +0200 Subject: [Gambas-user] signal#11 in Gambas3 In-Reply-To: <201008012200.59844.gambas@...1...> References: <4C541448.4030306@...221...> <201008012053.14745.gambas@...1...> <4C55D179.5010707@...221...> <201008012200.59844.gambas@...1...> Message-ID: <4C566F47.4060507@...221...> Ok, here you have a demo. You should get signal #11 if you abort the dialog. Move all the code from _new() to Form_Open(), and the crash is gone. Am 01.08.2010 22:00, schrieb Beno?t Minisini: > No, it's not your fault if you have a crash. And if you give me a way to > reproduce it, I will able to fix it. > -------------- next part -------------- A non-text attachment was scrubbed... Name: test-0.0.1.tar.gz Type: application/x-gzip Size: 4875 bytes Desc: not available URL: From ea7dfh at ...2382... Mon Aug 2 19:31:15 2010 From: ea7dfh at ...2382... (EA7DFH) Date: Mon, 02 Aug 2010 19:31:15 +0200 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 In-Reply-To: <201008011637.16423.gambas@...1...> References: <201008010211.32694.gambas@...1...> <4C558504.3090200@...2382...> <201008011637.16423.gambas@...1...> Message-ID: <4C5700E3.4050508@...2382...> El 01/08/10 16:37, Beno?t Minisini escribi?: El 01/08/10 02:11, Beno?t Minisini escribi?: Hi, As the subject said, I have disabled DatePicker and MessageLabel in the gb.form component, to see if someone use them. These controls have problems, especially the DatePicker, and if their creator want to fix them, they should tell me. Otherwise they may be removed, or rewritten if I have time and someone really needs them. In the same revision, you can add close buttons to TabStrip tabs, as someone asked recently. Regards, I use a custom DatePicker (based on DateChooser) extensively in my applications in Gambas2, I don't want it to disappear as a control when I begin migrating to Gambas3, as it saves a lot of code and it's a handsome control. So, please do not remove it... ;-) The DatePicker has many problems, so something must be done! I could not find the code for this widget. Where is located in the (trunk) source code? And, what are the *many* known problems? Regards -- Jesus, EA7DFH From gambas at ...1... Mon Aug 2 19:37:24 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 2 Aug 2010 19:37:24 +0200 Subject: [Gambas-user] =?utf-8?q?DatePicker_and_MessageLabel_were_disabled?= =?utf-8?q?_in=09revision_=233084?= In-Reply-To: <4C5700E3.4050508@...2382...> References: <201008010211.32694.gambas@...1...> <201008011637.16423.gambas@...1...> <4C5700E3.4050508@...2382...> Message-ID: <201008021937.24210.gambas@...1...> > El 01/08/10 16:37, Beno?t Minisini escribi?: > > El 01/08/10 02:11, Beno?t Minisini escribi?: > > > Hi, > > As the subject said, I have disabled DatePicker and MessageLabel in the > gb.form component, to see if someone use them. > > These controls have problems, especially the DatePicker, and if their > creator want to fix them, they should tell me. Otherwise they may be > removed, or rewritten if I have time and someone really needs them. > > In the same revision, you can add close buttons to TabStrip tabs, as > someone asked recently. > > Regards, > > > I use a custom DatePicker (based on DateChooser) extensively in my > applications in Gambas2, I don't want it to disappear as a control when > I begin migrating to Gambas3, as it saves a lot of code and it's a > handsome control. > > So, please do not remove it... ;-) > > > The DatePicker has many problems, so something must be done! > > > > I could not find the code for this widget. Where is located in the > (trunk) source code? > And, what are the *many* known problems? > Regards > -- > Jesus, EA7DFH Beside the code that is not very clean, the main problem is the lack of true popup mamangement. I am currently implementing a "ShowPopup" method that allow using a form as a popup, and I have written a control named "DateBox" with it, that will replace the DatePicker. At the moment, the problem is GTK+, which has no easy support for popups, so a lot of elbow grease and quick & dirty hacks are needed... Regards, -- Beno?t Minisini From ea7dfh at ...2382... Mon Aug 2 21:39:04 2010 From: ea7dfh at ...2382... (EA7DFH) Date: Mon, 02 Aug 2010 21:39:04 +0200 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 In-Reply-To: <201008021937.24210.gambas@...1...> References: <201008010211.32694.gambas@...1...> <201008011637.16423.gambas@...1...> <4C5700E3.4050508@...2382...> <201008021937.24210.gambas@...1...> Message-ID: <4C571ED8.2090408@...2382...> El 02/08/10 19:37, Beno?t Minisini escribi?: >> El 01/08/10 16:37, Beno?t Minisini escribi?: >> >> El 01/08/10 02:11, Beno?t Minisini escribi?: >> >> >> Hi, >> >> As the subject said, I have disabled DatePicker and MessageLabel in the >> gb.form component, to see if someone use them. >> >> These controls have problems, especially the DatePicker, and if their >> creator want to fix them, they should tell me. Otherwise they may be >> removed, or rewritten if I have time and someone really needs them. >> >> In the same revision, you can add close buttons to TabStrip tabs, as >> someone asked recently. >> >> Regards, >> >> >> I use a custom DatePicker (based on DateChooser) extensively in my >> applications in Gambas2, I don't want it to disappear as a control when >> I begin migrating to Gambas3, as it saves a lot of code and it's a >> handsome control. >> >> So, please do not remove it... ;-) >> >> >> The DatePicker has many problems, so something must be done! >> >> >> >> I could not find the code for this widget. Where is located in the >> (trunk) source code? >> And, what are the *many* known problems? >> Regards >> -- >> Jesus, EA7DFH >> > Beside the code that is not very clean, the main problem is the lack of true > popup mamangement. > > I am currently implementing a "ShowPopup" method that allow using a form as a > popup, and I have written a control named "DateBox" with it, that will replace > the DatePicker. > Sounds good. Many thanks for it. -the future Datebox :-)) Just for curiosity, this popup is a kind of floating panel in QT4? If yes, could it be detached from its parent? Well, you know what I mean: docking panels. > At the moment, the problem is GTK+, which has no easy support for popups, so a > lot of elbow grease and quick & dirty hacks are needed... > > Regards, > > I'm afraid I can not help you with that... Regards, -- Jesus, EA7DFH From gambas at ...1... Mon Aug 2 21:47:55 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 2 Aug 2010 21:47:55 +0200 Subject: [Gambas-user] DatePicker and MessageLabel were disabled in revision #3084 In-Reply-To: <4C571ED8.2090408@...2382...> References: <201008010211.32694.gambas@...1...> <201008021937.24210.gambas@...1...> <4C571ED8.2090408@...2382...> Message-ID: <201008022147.55400.gambas@...1...> > Sounds good. Many thanks for it. -the future Datebox :-)) > > Just for curiosity, this popup is a kind of floating panel in QT4? > > If yes, could it be detached from its parent? Well, you know what I > mean: docking panels. > Not at all. "Just" a popup window. -- Beno?t Minisini From gambas at ...1... Mon Aug 2 22:39:57 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 2 Aug 2010 22:39:57 +0200 Subject: [Gambas-user] signal#11 in Gambas3 In-Reply-To: <4C566F47.4060507@...221...> References: <4C541448.4030306@...221...> <201008012200.59844.gambas@...1...> <4C566F47.4060507@...221...> Message-ID: <201008022239.57141.gambas@...1...> > Ok, here you have a demo. You should get signal #11 if you abort the > dialog. Move all the code from _new() to Form_Open(), and the crash is > gone. > > Am 01.08.2010 22:00, schrieb Beno?t Minisini: > > No, it's not your fault if you have a crash. And if you give me a way to > > reproduce it, I will able to fix it. OK, it should be fixed in revision #3089. Regards, -- Beno?t Minisini From prog at ...2177... Tue Aug 3 00:15:52 2010 From: prog at ...2177... (craf) Date: Mon, 02 Aug 2010 18:15:52 -0400 Subject: [Gambas-user] Access only to the user's folder Message-ID: <1280787352.4909.1.camel@...2406...> Hi. I want the user to select the Dialog.SelectDirectory () only could choose or create folders within the folder /home. It can be done with Dialog.Path = User.home, but this does not stop so you can select the root directory / Regards From gambas at ...1... Tue Aug 3 00:22:18 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Tue, 3 Aug 2010 00:22:18 +0200 Subject: [Gambas-user] Access only to the user's folder In-Reply-To: <1280787352.4909.1.camel@...2406...> References: <1280787352.4909.1.camel@...2406...> Message-ID: <201008030022.18844.gambas@...1...> > Hi. > > I want the user to select the Dialog.SelectDirectory () only could > choose or create folders within the folder /home. > > It can be done with Dialog.Path = User.home, but this does not stop so > you can select the root directory / > > Regards > You have to implement your own file dialog with a FileChooser and a DirChooser. The DirChooser has a Root property that constraints the choice to a directory and its subdirectories. Regards, -- Beno?t Minisini From prog at ...2177... Tue Aug 3 01:03:12 2010 From: prog at ...2177... (craf) Date: Mon, 02 Aug 2010 19:03:12 -0400 Subject: [Gambas-user] Access only to the user's folder In-Reply-To: <201008030022.18844.gambas@...1...> References: <1280787352.4909.1.camel@...2406...> <201008030022.18844.gambas@...1...> Message-ID: <1280790192.6805.5.camel@...2406...> -----Mensaje original----- De: Beno?t Minisini Reply-to: mailing list for gambas users Para: mailing list for gambas users Asunto: Re: [Gambas-user] Access only to the user's folder Fecha: Tue, 3 Aug 2010 00:22:18 +0200 > Hi. > > I want the user to select the Dialog.SelectDirectory () only could > choose or create folders within the folder /home. > > It can be done with Dialog.Path = User.home, but this does not stop so > you can select the root directory / > > Regards > >You have to implement your own file dialog with a FileChooser and a >DirChooser. >The DirChooser has a Root property that constraints the choice to a directory >and its subdirectories. >Regards, Hi. If I choose to FileChooser or DirChooser, these show me the folder icons to the theme of Gnome. By using Dialog.SelectDirectory, this shows me the folder icons to the theme that the user has selected. Is there any way to emulate this behavior in them?. Regards From afroehlke at ...784... Wed Aug 4 08:26:56 2010 From: afroehlke at ...784... (=?utf-8?B?QW5kcmVhcyBGcsO2aGxrZQ==?=) Date: Wed, 4 Aug 2010 08:26:56 +0200 Subject: [Gambas-user] WebBrowser - read out the shown html document In-Reply-To: <1280790192.6805.5.camel@...2406...> References: <1280787352.4909.1.camel@...2406...> <201008030022.18844.gambas@...1...> <1280790192.6805.5.camel@...2406...> Message-ID: <8D42310D957CFB46AA11921A711D4D160274FF8CC0@...1899...> Hello, I use the Gambas-Browser to open an shopping website. There the user can choose his products and order them. T last page of the shop is a status page with all informations in the html-source-code written as comments, which i must read out and save in a mysql database. Is there a way to read out the html-code of the website the gambas webbrowser is currently shown? Regards - A.Fr?hlke - From dosida at ...626... Wed Aug 4 11:24:28 2010 From: dosida at ...626... (Dimitris Anogiatis) Date: Wed, 4 Aug 2010 03:24:28 -0600 Subject: [Gambas-user] WebBrowser - read out the shown html document In-Reply-To: <8D42310D957CFB46AA11921A711D4D160274FF8CC0@...1899...> References: <1280787352.4909.1.camel@...2406...> <201008030022.18844.gambas@...1...> <1280790192.6805.5.camel@...2406...> <8D42310D957CFB46AA11921A711D4D160274FF8CC0@...1899...> Message-ID: Hey Andreas, >From what I've read in the documentation there's no text property or any other way to get the source code of the currently showing webpage in the webbrowser control... yet; so after a bit of googling this is what I've come up with. assuming that your webbrowser control is called Webbrowser1 you can do this PUBLIC SUB WebBrowser1_Click() DIM tempHTML AS String DIM tempLink AS String tempLink = WebBrowser1.Link SHELL ("wget -qO- " & tempLink & "|cat") TO tempHTML PRINT tempHTML END This piece of code will retrieve the code of the page you just clicked and send the html code to the tempHTML variable It's a bit crude, not 100% tested but I think it works. I hope this helps till someone else has a better way to do it from within the webbrowser control Regards Dimtris On Wed, Aug 4, 2010 at 12:26 AM, Andreas Fr?hlke wrote: > Hello, > > I use the Gambas-Browser to open an shopping website. There the user can > choose his products and order them. T last page of the shop is a status page > with all informations in the html-source-code written as comments, which i > must read out and save in a mysql database. Is there a way to read out the > html-code of the website the gambas webbrowser is currently shown? > > Regards > > - A.Fr?hlke - > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From afroehlke at ...784... Wed Aug 4 13:35:14 2010 From: afroehlke at ...784... (=?iso-8859-1?Q?Andreas_Fr=F6hlke?=) Date: Wed, 4 Aug 2010 13:35:14 +0200 Subject: [Gambas-user] WebBrowser - read out the shown html document In-Reply-To: References: <1280787352.4909.1.camel@...2406...> <201008030022.18844.gambas@...1...> <1280790192.6805.5.camel@...2406...> <8D42310D957CFB46AA11921A711D4D160274FF8CC0@...1899...> Message-ID: <8D42310D957CFB46AA11921A711D4D160274FF8CCD@...1899...> Hi Dimitris, thanks, thanks, thanks for this solution. It works perfectly. Regards - Andreas - -----Urspr?ngliche Nachricht----- Von: Dimitris Anogiatis [mailto:dosida at ...626...] Gesendet: Mittwoch, 4. August 2010 11:24 An: mailing list for gambas users Betreff: Re: [Gambas-user] WebBrowser - read out the shown html document Hey Andreas, >From what I've read in the documentation there's no text property or any other way to get the source code of the currently showing webpage in the webbrowser control... yet; so after a bit of googling this is what I've come up with. assuming that your webbrowser control is called Webbrowser1 you can do this PUBLIC SUB WebBrowser1_Click() DIM tempHTML AS String DIM tempLink AS String tempLink = WebBrowser1.Link SHELL ("wget -qO- " & tempLink & "|cat") TO tempHTML PRINT tempHTML END This piece of code will retrieve the code of the page you just clicked and send the html code to the tempHTML variable It's a bit crude, not 100% tested but I think it works. I hope this helps till someone else has a better way to do it from within the webbrowser control Regards Dimtris On Wed, Aug 4, 2010 at 12:26 AM, Andreas Fr?hlke wrote: > Hello, > > I use the Gambas-Browser to open an shopping website. There the user can > choose his products and order them. T last page of the shop is a status page > with all informations in the html-source-code written as comments, which i > must read out and save in a mysql database. Is there a way to read out the > html-code of the website the gambas webbrowser is currently shown? > > Regards > > - A.Fr?hlke - > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ Gambas-user mailing list Gambas-user at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user From gambas at ...1... Wed Aug 4 13:43:46 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Wed, 4 Aug 2010 13:43:46 +0200 Subject: [Gambas-user] WebBrowser - read out the shown html document In-Reply-To: <8D42310D957CFB46AA11921A711D4D160274FF8CCD@...1899...> References: <1280787352.4909.1.camel@...2406...> <8D42310D957CFB46AA11921A711D4D160274FF8CCD@...1899...> Message-ID: <201008041343.46946.gambas@...1...> > Hi Dimitris, > > thanks, thanks, thanks for this solution. It works perfectly. > > Regards > > - Andreas - > > Or, In Gambas 3, WebView has a HTML property. Regards, -- Beno?t Minisini From matiasgrandi at ...626... Wed Aug 4 13:50:13 2010 From: matiasgrandi at ...626... (=?UTF-8?Q?Mat=C3=ADas_Manuel_Grandi?=) Date: Wed, 4 Aug 2010 08:50:13 -0300 Subject: [Gambas-user] Parsing a xml file from internet Message-ID: Hi guys! First of all...I'm new to gambas! I'm traying to parse a xml from http://8tracks.com/sets/460486803/play.xml?mix_id=2000 I can get the file with the following code: ' Gambas class file PUBLIC url AS String PUBLIC SUB Form_Open() DIM reader AS XmlReader DIM h AS HttpClient DIM buffer AS String DIM doc AS XmlDocument h = NEW HttpClient AS "h" h.URL = "http://8tracks.com/sets/460486803/play.xml?mix_id=2000" h.Async = FALSE h.Timeout = 60 h.Get IF h.Status < 0 THEN PRINT "ERROR" ELSE ' Success - read the data IF Lof(h) THEN READ #h, buffer, Lof(h) END IF The xml file is now in a varaible called "buffer". How can I get it from xmlread object? Thanks! Mato.- From gambas at ...1... Wed Aug 4 13:59:18 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Wed, 4 Aug 2010 13:59:18 +0200 Subject: [Gambas-user] Access only to the user's folder In-Reply-To: <1280790192.6805.5.camel@...2406...> References: <1280787352.4909.1.camel@...2406...> <201008030022.18844.gambas@...1...> <1280790192.6805.5.camel@...2406...> Message-ID: <201008041359.18371.gambas@...1...> > -----Mensaje original----- > De: Beno?t Minisini > Reply-to: mailing list for gambas users > > Para: mailing list for gambas users > Asunto: Re: [Gambas-user] Access only to the user's folder > Fecha: Tue, 3 Aug 2010 00:22:18 +0200 > > > Hi. > > > > I want the user to select the Dialog.SelectDirectory () only could > > choose or create folders within the folder /home. > > > > It can be done with Dialog.Path = User.home, but this does not stop so > > you can select the root directory / > > > > Regards > > > >You have to implement your own file dialog with a FileChooser and a > >DirChooser. > > > >The DirChooser has a Root property that constraints the choice to a > >directory and its subdirectories. > > > >Regards, > > Hi. > > If I choose to FileChooser or DirChooser, these show me the folder icons to > the theme of Gnome. By using Dialog.SelectDirectory, this shows me the > folder icons to the theme that the user has selected. Is there any way to > emulate this behavior in them?. > > Regards > Do you have screenshots to show me what you are talking about? Beware that a mailing-list post is limited to 256K. Regards, -- Beno?t Minisini From austinium at ...43... Wed Aug 4 14:01:11 2010 From: austinium at ...43... (vikram) Date: Wed, 4 Aug 2010 05:01:11 -0700 (PDT) Subject: [Gambas-user] Confirm on form close Message-ID: <844036.14911.qm@...2467...> Hi, Is there a way to confirm from a user when decides to close a form? PUBLIC SUB Form_Close() ? DIM retVal AS Integer ? retval = Message.Question("Are you sure you want to exit?", "Yes", "No") ? IF retVal = 1 THEN ??? ME.Close ? ELSE IF retVal = 2 THEN ??? 'code to prevent the form from exiting ? ENDIF END Nothing i've put there seems to have been able to stop the form from exiting so far. Thanks Vikram From gambas at ...1... Wed Aug 4 14:05:45 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Wed, 4 Aug 2010 14:05:45 +0200 Subject: [Gambas-user] pdf component question In-Reply-To: <201007252024.21928.rterry@...1946...> References: <201007252024.21928.rterry@...1946...> Message-ID: <201008041405.45587.gambas@...1...> > I wondered where the full documentation is for this compoent. > > The pdf viewer will do things like hightlight test you want to search for, > but I wondered if there is a machanism of 'going to' the first occurrence. > > There is a couple of goto properties, but the mini-help which come up but > no explanation of how to use them. > > Regards > > Richard > Here is what I could guess by reading the source code of the component: PdfDocument[Page].Find() will search all occurences of a text into the specified page. Then: PdfDocument[Page].Result.Count returns the number of matches, and PdfDocument[Page].Result[Index] a virtual object that represents the rectangle surrounding the text in the page. Maybe if Index = 0, you have the first match? Is it what you are looking for? -- Beno?t Minisini From gambas at ...1... Wed Aug 4 14:06:21 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Wed, 4 Aug 2010 14:06:21 +0200 Subject: [Gambas-user] Confirm on form close In-Reply-To: <844036.14911.qm@...2467...> References: <844036.14911.qm@...2467...> Message-ID: <201008041406.21173.gambas@...1...> > Hi, > > Is there a way to confirm from a user when decides to close a form? > > PUBLIC SUB Form_Close() > DIM retVal AS Integer > retval = Message.Question("Are you sure you want to exit?", "Yes", "No") > IF retVal = 1 THEN > ME.Close > ELSE IF retVal = 2 THEN > 'code to prevent the form from exiting > ENDIF > END > > Nothing i've put there seems to have been able to stop the form from > exiting so far. > > Thanks > Vikram > You have to cancel the event with the STOP EVENT instruction. Regards, -- Beno?t Minisini From prog at ...2177... Wed Aug 4 17:08:34 2010 From: prog at ...2177... (craf) Date: Wed, 04 Aug 2010 11:08:34 -0400 Subject: [Gambas-user] Access only to the user's folder In-Reply-To: <201008041359.18371.gambas@...1...> References: <1280787352.4909.1.camel@...2406...> <201008030022.18844.gambas@...1...> <1280790192.6805.5.camel@...2406...> <201008041359.18371.gambas@...1...> Message-ID: <1280934514.3267.9.camel@...2406...> -----Mensaje original----- De: Beno?t Minisini Reply-to: mailing list for gambas users Para: mailing list for gambas users Asunto: Re: [Gambas-user] Access only to the user's folder Fecha: Wed, 4 Aug 2010 13:59:18 +0200 > -----Mensaje original----- > De: Beno?t Minisini > Reply-to: mailing list for gambas users > > Para: mailing list for gambas users > Asunto: Re: [Gambas-user] Access only to the user's folder > Fecha: Tue, 3 Aug 2010 00:22:18 +0200 > > > Hi. > > > > I want the user to select the Dialog.SelectDirectory () only could > > choose or create folders within the folder /home. > > > > It can be done with Dialog.Path = User.home, but this does not stop so > > you can select the root directory / > > > > Regards > > > >You have to implement your own file dialog with a FileChooser and a > >DirChooser. > > > >The DirChooser has a Root property that constraints the choice to a > >directory and its subdirectories. > > > >Regards, > > Hi. > > If I choose to FileChooser or DirChooser, these show me the folder icons to > the theme of Gnome. By using Dialog.SelectDirectory, this shows me the > folder icons to the theme that the user has selected. Is there any way to > emulate this behavior in them?. > > Regards > >Do you have screenshots to show me what you are talking about? Beware that a >mailing-list post is limited to 256K. >Regards, Hi When I use the controls DirChooser and FileChooser , the icons displayed are those that come in the Gnome theme. But when I use dialog.Selectdirectory (), the icons shown are the subject of ongoing use, which is Human. Is there any way to change this behavior in gb.gtk sources? Regards. -------------- next part -------------- A non-text attachment was scrubbed... Name: dialogselectdirectory.png Type: image/png Size: 16547 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: dirchooser.png Type: image/png Size: 17372 bytes Desc: not available URL: From gambas at ...1... Wed Aug 4 17:18:56 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Wed, 4 Aug 2010 17:18:56 +0200 Subject: [Gambas-user] Access only to the user's folder In-Reply-To: <1280934514.3267.9.camel@...2406...> References: <1280787352.4909.1.camel@...2406...> <201008041359.18371.gambas@...1...> <1280934514.3267.9.camel@...2406...> Message-ID: <201008041718.56738.gambas@...1...> > > Hi. > > > > If I choose to FileChooser or DirChooser, these show me the folder icons > > to the theme of Gnome. By using Dialog.SelectDirectory, this shows me > > the folder icons to the theme that the user has selected. Is there any > > way to emulate this behavior in them?. > > > > Regards > > > >Do you have screenshots to show me what you are talking about? Beware that > >a mailing-list post is limited to 256K. > > > >Regards, > > Hi > > When I use the controls DirChooser and FileChooser , the icons displayed > are those that come in the Gnome theme. > > > > But when I use dialog.Selectdirectory (), the icons shown are the subject > of ongoing use, which is Human. > > > > Is there any way to change this behavior in gb.gtk sources? > > Regards. It has nothing to do with gb.gtk and icon theme. Directory specific icons is a freedesktop standard that the DirChooser control does not handle, for simplicity reasons. And because it needs to access a directory stored inside a folder making things slower. Two remarks: - I may implement that in the future. - Storing how directories should be viewed inside the directory is a stupid design. Why on the heck did they do that? :-( If two users want to see the same directory differently, what should we do? -- Beno?t Minisini From prog at ...2177... Wed Aug 4 17:30:19 2010 From: prog at ...2177... (craf) Date: Wed, 04 Aug 2010 11:30:19 -0400 Subject: [Gambas-user] Access only to the user's folder In-Reply-To: <201008041718.56738.gambas@...1...> References: <1280787352.4909.1.camel@...2406...> <201008041359.18371.gambas@...1...> <1280934514.3267.9.camel@...2406...> <201008041718.56738.gambas@...1...> Message-ID: <1280935819.3267.17.camel@...2406...> -----Mensaje original----- De: Beno?t Minisini Reply-to: mailing list for gambas users Para: mailing list for gambas users Asunto: Re: [Gambas-user] Access only to the user's folder Fecha: Wed, 4 Aug 2010 17:18:56 +0200 > > Hi. > > > > If I choose to FileChooser or DirChooser, these show me the folder icons > > to the theme of Gnome. By using Dialog.SelectDirectory, this shows me > > the folder icons to the theme that the user has selected. Is there any > > way to emulate this behavior in them?. > > > > Regards > > > >Do you have screenshots to show me what you are talking about? Beware that > >a mailing-list post is limited to 256K. > > > >Regards, > > Hi > > When I use the controls DirChooser and FileChooser , the icons displayed > are those that come in the Gnome theme. > > > > But when I use dialog.Selectdirectory (), the icons shown are the subject > of ongoing use, which is Human. > > > > Is there any way to change this behavior in gb.gtk sources? > > Regards. >It has nothing to do with gb.gtk and icon theme. >Directory specific icons is a freedesktop standard that the DirChooser control >does not handle, for simplicity reasons. And because it needs to access a >directory stored inside a folder making things slower. >Two remarks: >- I may implement that in the future. >- Storing how directories should be viewed inside the directory is a stupid >design. Why on the heck did they do that? :-( If two users want to see the >same directory differently, what should we do? Ok, Thank you. Regards. From math.eber at ...221... Wed Aug 4 17:44:07 2010 From: math.eber at ...221... (Matti) Date: Wed, 04 Aug 2010 17:44:07 +0200 Subject: [Gambas-user] Another signal #11 in Gambas3 Message-ID: <4C598AC7.3000104@...221...> I seem to attract them magically... Example attatched. Regards Matti -------------- next part -------------- A non-text attachment was scrubbed... Name: test-0.0.2.tar.gz Type: application/x-gzip Size: 5074 bytes Desc: not available URL: From math.eber at ...221... Wed Aug 4 17:50:26 2010 From: math.eber at ...221... (Matti) Date: Wed, 04 Aug 2010 17:50:26 +0200 Subject: [Gambas-user] Confirm on form close In-Reply-To: <844036.14911.qm@...2467...> References: <844036.14911.qm@...2467...> Message-ID: <4C598C42.2060605@...221...> >From Gambas Help: STOP EVENT Works in Gambas3, if not in Gambas2, look in the help. Regards Matti Am 04.08.2010 14:01, schrieb vikram: > Hi, > > Is there a way to confirm from a user when decides to close a form? > > PUBLIC SUB Form_Close() > DIM retVal AS Integer > retval = Message.Question("Are you sure you want to exit?", "Yes", "No") > IF retVal = 1 THEN > ME.Close > ELSE IF retVal = 2 THEN > 'code to prevent the form from exiting > ENDIF > END > > Nothing i've put there seems to have been able to stop the form from exiting so far. > > Thanks > Vikram > > > > > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From math.eber at ...221... Wed Aug 4 18:37:11 2010 From: math.eber at ...221... (Matti) Date: Wed, 04 Aug 2010 18:37:11 +0200 Subject: [Gambas-user] Confirm on form close In-Reply-To: <844036.14911.qm@...2467...> References: <844036.14911.qm@...2467...> Message-ID: <4C599737.7070403@...221...> Sorry, didn't see that Benoit had already answered. But, besides the code: Why do you ask the user (who just has decided) if he wants to decide? I really hate programs that ask me things like that. If I close a form by mistake, I open it again. I think the questions on Form_Close event should be restricted to important things like possible data loss. Matti Am 04.08.2010 14:01, schrieb vikram: > Hi, > > Is there a way to confirm from a user when decides to close a form? > > PUBLIC SUB Form_Close() > DIM retVal AS Integer > retval = Message.Question("Are you sure you want to exit?", "Yes", "No") > IF retVal = 1 THEN > ME.Close > ELSE IF retVal = 2 THEN > 'code to prevent the form from exiting > ENDIF > END > > Nothing i've put there seems to have been able to stop the form from exiting so far. > > Thanks > Vikram > > > > > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From rterry at ...1946... Wed Aug 4 23:27:32 2010 From: rterry at ...1946... (richard terry) Date: Thu, 5 Aug 2010 07:27:32 +1000 Subject: [Gambas-user] pdf component question In-Reply-To: <201008041405.45587.gambas@...1...> References: <201007252024.21928.rterry@...1946...> <201008041405.45587.gambas@...1...> Message-ID: <201008050727.32413.rterry@...1946...> On Wednesday 04 August 2010 22:05:45 Beno?t Minisini wrote: > > I wondered where the full documentation is for this compoent. > > > > The pdf viewer will do things like hightlight test you want to search > > for, but I wondered if there is a machanism of 'going to' the first > > occurrence. > > > > There is a couple of goto properties, but the mini-help which come up but > > no explanation of how to use them. > > > > Regards > > > > Richard > > Here is what I could guess by reading the source code of the component: > > PdfDocument[Page].Find() will search all occurences of a text into the > specified page. > > Then: PdfDocument[Page].Result.Count returns the number of matches, and > PdfDocument[Page].Result[Index] a virtual object that represents the > rectangle surrounding the text in the page. > > Maybe if Index = 0, you have the first match? > > Is it what you are looking for? > Will go back to what I was doing at time of the post and dig-est your email. Thanks very much. Richard From mohareve at ...626... Thu Aug 5 09:42:41 2010 From: mohareve at ...626... (M. Cs.) Date: Thu, 5 Aug 2010 09:42:41 +0200 Subject: [Gambas-user] Track playing process bar Message-ID: I would like to add a progress bar / line to a MP3 player. Is it possible to retrieve the length and the current position of the track with Gambas2 ? Thanks! From gambas at ...1... Thu Aug 5 11:04:52 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Thu, 5 Aug 2010 11:04:52 +0200 Subject: [Gambas-user] Track playing process bar In-Reply-To: References: Message-ID: <201008051104.52285.gambas@...1...> > I would like to add a progress bar / line to a MP3 player. Is it possible > to retrieve the length and the current position of the track with Gambas2 > ? Thanks! Alas, not for MP3. SDL has no way to guess the length of a MP3 file (funny format isn't it?). You just have the time position. Regards, -- Beno?t Minisini From austinium at ...43... Thu Aug 5 11:05:46 2010 From: austinium at ...43... (vikram) Date: Thu, 5 Aug 2010 02:05:46 -0700 (PDT) Subject: [Gambas-user] Confirm on form close Message-ID: <891447.1364.qm@...2468...> @Benoit: Thank you :) @Matti: Thanks, it works on Gambas2. I am working on a Live Installer which would work on Debian & BOSS/GNU Linux. From alerinaldi at ...2334... Thu Aug 5 09:46:50 2010 From: alerinaldi at ...2334... (Alessandro Rinaldi) Date: Thu, 5 Aug 2010 09:46:50 +0200 Subject: [Gambas-user] Track playing process bar In-Reply-To: References: Message-ID: You can get the current position but not the total lenght :) I used some software that gives infos about MP3s (including total lenght) in the shell, calling it from GB, to avoid the problem! From wellspinto at ...626... Thu Aug 5 15:49:12 2010 From: wellspinto at ...626... (Wellington de Souza Pinto) Date: Thu, 5 Aug 2010 10:49:12 -0300 Subject: [Gambas-user] Minimize button event on forms Message-ID: Hi! Any idea about capture minimize button event in forms? Tks From johny.provoost at ...27... Thu Aug 5 17:33:23 2010 From: johny.provoost at ...27... (Johny Provoost) Date: Thu, 05 Aug 2010 17:33:23 +0200 Subject: [Gambas-user] Track playing process bar In-Reply-To: <201008051104.52285.gambas@...1...> References: <201008051104.52285.gambas@...1...> Message-ID: <4C5AD9C3.20106@...27...> I would like to add a progress bar / line to a MP3 player. Is it possible >> to retrieve the length and the current position of the track with Gambas2 >> ? Thanks! >> > Alas, not for MP3. SDL has no way to guess the length of a MP3 file (funny > format isn't it?). You just have the time position. > > Regards, > > I know it's very durty but you can read the tags of the mp3 file. (only possibility I found within my small knowledge of programming. You must have exiftool installed. I use Ubuntu and exiftool is not standard installed. /'Create tags PUBLIC FUNCTION FillTags(vFile AS String) DIM hTags AS File DIM NoNeedFor AS String DIM vIndex AS Integer = 0 vIDindex = vIDindex + 1 Start.lblOpstarten.Text = ("Ogenblikje a.u.b. Bezig met aanmaken muziekdatabase - Record: " & Str$(vIDindex)) WAIT 0.01 'Read Tags ' Put the tags in a textfile. The name and path of the mp3 is in vFile and write the tags in a txtfile tagstmp. SHELL "exiftool " & "\"" & vFile & "\"" & " >" & FMain.EigenDir & "/jepe/SiMuP/tagstmp " WAIT 'Open the file for reading hTags = OPEN FMain.EigenDir & "/jepe/SiMuP/tagstmp" FOR INPUT WHILE NOT Eof(hTags) LINE INPUT #hTags, NoNeedFor '1-Exiftool Version Number IF Left$(NoNeedFor, 9) = "File Name" THEN vFilename = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 9) = "Directory" THEN vDirectory = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 27) = "File Modification Date/Time" THEN vFileModification = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ": ") - 1) ENDIF IF Left$(NoNeedFor, 13) = "Audio Bitrate" THEN vBitrate = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 11) = "Sample Rate" THEN vSampleRate = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 12) = "Channel Mode" THEN vChannelMode = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 5) = "Title" THEN vTitle = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 6) = "Artist" THEN vArtist = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 5) = "Album" THEN vAlbum = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, " : ") - 1) ENDIF IF Left$(NoNeedFor, 5) = "Track" THEN vTrack = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 5) = "Genre" THEN vGenre = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 8) = "Composer" THEN vComposer = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 4) = "Year" THEN vYear = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ":") - 1) ENDIF IF Left$(NoNeedFor, 8) = "Duration" THEN vDuration = Right$(NoNeedFor, Len(NoNeedFor) - RInStr(NoNeedFor, ": ") - 1) vDuration = Left$(vDuration, 5) ENDIF WEND CLOSE #hTags/ Greetings Johny From rospolosco at ...152... Thu Aug 5 18:33:27 2010 From: rospolosco at ...152... (Stefano Palmeri) Date: Thu, 5 Aug 2010 18:33:27 +0200 Subject: [Gambas-user] Minimize button event on forms In-Reply-To: References: Message-ID: <201008051833.27933.rospolosco@...152...> Il gioved? 5 agosto 2010 15:49:12 Wellington de Souza Pinto ha scritto: > Hi! > > Any idea about capture minimize button event in forms? > > Tks The only way I know is a workaround. It works with gb.Qt. PUBLIC SUB Form_Deactivate() IF ME.Minimized THEN PRINT "I'm minimized" END Stefano > --------------------------------------------------------------------------- >--- The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user From mohareve at ...626... Fri Aug 6 17:36:47 2010 From: mohareve at ...626... (M. Cs.) Date: Fri, 6 Aug 2010 17:36:47 +0200 Subject: [Gambas-user] Dinamic menu structures Message-ID: My goal: Let's have a mobile phone, and I would like to send data (images, mp3) to the phone, but I don't know how the directory structure of that certain phone would look like. I would like to have a "Send to:" option which is present for e.g in Konqueror, which would enable me to browse the directory structure and to point to the desired folder. I've tried to create arrays of Menus, but it isn't possible. Usually I define a fixed number of submenus inside the subroutine: PUBLIC SUB Element_Menu() DIM menu1,menu2,....menuN AS Menu menu1=NEW Menu(container) menu1.Text=.... menu1.Action=.... END And the Actions are global variables of the containing Form, which are raised inside the subroutine Action_Activate() Is there another approach? This all is only for static number of elements. I'd like to create a menu-tree. How if possible? From math.eber at ...221... Fri Aug 6 18:14:06 2010 From: math.eber at ...221... (Matti) Date: Fri, 06 Aug 2010 18:14:06 +0200 Subject: [Gambas-user] Dinamic menu structures In-Reply-To: References: Message-ID: <4C5C34CE.3020608@...221...> I don't understand why you want to handle this with menus. If you want "to browse the directory structure and to point to the desired folder", it's done with a Dialog: DIM myPath as String Dialog.Title = "Look for the mobile phone" Dialog.Path = System.Path If Dialog.SelectDirectory() Then Return myPath = Dialog.Path Print myPath Instead of 'System.Path' you could define any start folder. And afterwards you can copy things easily to myPath on the phone. Or do I misunderstand you completely? Matti Am 06.08.2010 17:36, schrieb M. Cs.: > My goal: Let's have a mobile phone, and I would like to send data (images, > mp3) to the phone, but I don't know how the directory structure of that > certain phone would look like. I would like to have a "Send to:" option > which is present for e.g in Konqueror, which would enable me to browse the > directory structure and to point to the desired folder. I've tried to create > arrays of Menus, but it isn't possible. > Usually I define a fixed number of submenus inside the subroutine: > > PUBLIC SUB Element_Menu() > DIM menu1,menu2,....menuN AS Menu > menu1=NEW Menu(container) > menu1.Text=.... > menu1.Action=.... > > END > > And the Actions are global variables of the containing Form, which are > raised inside the subroutine > Action_Activate() > > Is there another approach? This all is only for static number of elements. > I'd like to create a menu-tree. How if possible? > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From mohareve at ...626... Fri Aug 6 18:27:07 2010 From: mohareve at ...626... (M. Cs.) Date: Fri, 6 Aug 2010 18:27:07 +0200 Subject: [Gambas-user] Dinamic menu structures In-Reply-To: <4C5C34CE.3020608@...221...> References: <4C5C34CE.3020608@...221...> Message-ID: 2010/8/6 Matti > I don't understand why you want to handle this with menus. > If you want "to browse the directory structure and to point to the desired > folder", it's done with a Dialog: > > DIM myPath as String > Dialog.Title = "Look for the mobile phone" > Dialog.Path = System.Path > If Dialog.SelectDirectory() Then Return > myPath = Dialog.Path > Print myPath > > Instead of 'System.Path' you could define any start folder. > And afterwards you can copy things easily to myPath on the phone. > > Or do I misunderstand you completely? > Matti > > Am 06.08.2010 17:36, schrieb M. Cs.: > > My goal: Let's have a mobile phone, and I would like to send data > (images, > > mp3) to the phone, but I don't know how the directory structure of that > > certain phone would look like. I would like to have a "Send to:" option > > which is present for e.g in Konqueror, which would enable me to browse > the > > directory structure and to point to the desired folder. I've tried to > create > > arrays of Menus, but it isn't possible. > > Usually I define a fixed number of submenus inside the subroutine: > > > > PUBLIC SUB Element_Menu() > > DIM menu1,menu2,....menuN AS Menu > > menu1=NEW Menu(container) > > menu1.Text=.... > > menu1.Action=.... > > > > END > > > > And the Actions are global variables of the containing Form, which are > > raised inside the subroutine > > Action_Activate() > > > > Is there another approach? This all is only for static number of > elements. > > I'd like to create a menu-tree. How if possible? > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by > > > > Make an app they can't live without > > Enter the BlackBerry Developer Challenge > > http://p.sf.net/sfu/RIM-dev2dev > > _______________________________________________ > > Gambas-user mailing list > > Gambas-user at lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user Yes, you did: Let's say I have a TableView with elements (files) which could be copied onto a USB device. I have a popup menu attached to that TableView, and if I'd invoke right-click over an element, the program would inspect whether there are USB devices attached to the PC, and if yes, it would offer to choose between them (right now it works with max. 2 devices) and it would build the directory tree of the choosen device and I could point to the folder 'playlists' for example, and the program would copy the element into USB's ~/.../playlists folder. Why? Because it's more elegant way than the dialogs! It already works for the USB device's root folder but no deeper. Is it clear now? From mohareve at ...626... Fri Aug 6 18:29:31 2010 From: mohareve at ...626... (M. Cs.) Date: Fri, 6 Aug 2010 18:29:31 +0200 Subject: [Gambas-user] Dinamic menu structures In-Reply-To: References: <4C5C34CE.3020608@...221...> Message-ID: Off course, I would like to have a menu structure where each submenu item represents a subfolder recursively. From gambas.fr at ...626... Fri Aug 6 19:03:53 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Fri, 6 Aug 2010 19:03:53 +0200 Subject: [Gambas-user] Dinamic menu structures In-Reply-To: References: <4C5C34CE.3020608@...221...> Message-ID: Public Function FillMenu(MenuParent as Menu) dim s as string dim hMenu as Menu MenuParent.Children[0].Delete For each s in Dir(MenuParent.Tag,"*", gb.directory) hMenu = new Menu(MenuParent) hMenu.Text = s hMenu.Picture = Picture["icon:/small/directory"] if isDrir(MenuParent.Tag &/ s) then hMenu = new Menu(MenuParent) hMenu.Text=".Child." endif next oups no time to finish ... this is a way endif 2010/8/6 M. Cs. : > Off course, I would like to have a menu structure where each submenu item > represents a subfolder recursively. > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From mohareve at ...626... Fri Aug 6 19:43:36 2010 From: mohareve at ...626... (M. Cs.) Date: Fri, 6 Aug 2010 19:43:36 +0200 Subject: [Gambas-user] Dinamic menu structures In-Reply-To: References: <4C5C34CE.3020608@...221...> Message-ID: Great, Fabien, it looks it will work! I'll write to tell if I managed to do it completely. Thanks! Csaba From kevinfishburne at ...1887... Fri Aug 6 20:09:37 2010 From: kevinfishburne at ...1887... (kevinfishburne) Date: Fri, 6 Aug 2010 11:09:37 -0700 (PDT) Subject: [Gambas-user] gb.image: how to keep a rotated image centered Message-ID: <29356475.post@...1379...> I'm attempting to rotate an image about its center point, using something like: DIM background AS Image = Image.Load("grass.png") DIM f AS Float FOR f = 0 TO 6.2831853 STEP 0.01 Draw.Begin(DrawingArea) Draw.Image(background.Rotate(f), 0, 0) Draw.End WAIT NEXT The resolution of the returned rotated image actually changes based on the angle, such that the entire original image is preserved (no clipping occurs). This would be extremely useful in most cases, but not in mine as I'm making a game. Anyone know what math I should use to try to keep the rotated image centered about its mid-point while being rotated? Thanks all. ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:sales at ...1887... sales at ...1887... phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-how-to-keep-a-rotated-image-centered-tp29356475p29356475.html Sent from the gambas-user mailing list archive at Nabble.com. From mohareve at ...626... Fri Aug 6 21:09:56 2010 From: mohareve at ...626... (M. Cs.) Date: Fri, 6 Aug 2010 21:09:56 +0200 Subject: [Gambas-user] Dinamic menu structures In-Reply-To: References: <4C5C34CE.3020608@...221...> Message-ID: Another question: how to read the text of the selected menu item, which were dinamically created? From jussi.lahtinen at ...626... Fri Aug 6 22:35:34 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Fri, 6 Aug 2010 23:35:34 +0300 Subject: [Gambas-user] gb.image: how to keep a rotated image centered In-Reply-To: <29356475.post@...1379...> References: <29356475.post@...1379...> Message-ID: There is probably more efficient ways, but quick and dirty... Here: DIM background AS Image = Image.Load("kuva1.jpg") DIM bg2 AS Image DIM f AS Float DIM ii AS Integer DIM jj AS Integer ii = background.Width / 2 jj = background.Height / 2 FOR f = 0 TO 6.2831853 STEP 0.01 Draw.Begin(DrawingArea1) bg2 = background.Rotate(f) Draw.Image(bg2, (ii - (bg2.Width / 2)), (jj - (bg2.Height / 2))) Draw.End WAIT NEXT Jussi On Fri, Aug 6, 2010 at 21:09, kevinfishburne wrote: > > I'm attempting to rotate an image about its center point, using something > like: > > DIM background AS Image = Image.Load("grass.png") > DIM f AS Float > > FOR f = 0 TO 6.2831853 STEP 0.01 > ?Draw.Begin(DrawingArea) > ? ?Draw.Image(background.Rotate(f), 0, 0) > ?Draw.End > ?WAIT > NEXT > > The resolution of the returned rotated image actually changes based on the > angle, such that the entire original image is preserved (no clipping > occurs). This would be extremely useful in most cases, but not in mine as > I'm making a game. > > Anyone know what math I should use to try to keep the rotated image centered > about its mid-point while being rotated? Thanks all. > > ----- > Kevin Fishburne, Eight Virtues > www: ?http://sales.eightvirtues.com http://sales.eightvirtues.com > e-mail: ?mailto:sales at ...1887... sales at ...1887... > phone: (770) 853-6271 > -- > View this message in context: http://old.nabble.com/gb.image%3A-how-to-keep-a-rotated-image-centered-tp29356475p29356475.html > Sent from the gambas-user mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From kevinfishburne at ...1887... Fri Aug 6 22:48:52 2010 From: kevinfishburne at ...1887... (Kevin Fishburne) Date: Fri, 06 Aug 2010 16:48:52 -0400 Subject: [Gambas-user] gb.image: how to keep a rotated image centered Message-ID: <4C5C7534.8010808@...1887...> "old" Nabble is falling apart. It seems to randomly fail to accept my posts. Good times. Anyway, here's the post bypassing Nabble: I'm attempting to rotate an image about its center point, using something like: DIM background AS Image = Image.Load("grass.png") DIM f AS Float FOR f = 0 TO 6.2831853 STEP 0.01 Draw.Begin(DrawingArea) Draw.Image(background.Rotate(f), 0, 0) Draw.End WAIT NEXT The resolution of the returned rotated image actually changes based on the angle, such that the entire original image is preserved (no clipping occurs). This would be extremely useful in most cases, but not in mine as I'm making a game. Anyone know what math I should use to try to keep the rotated image centered about its mid-point while being rotated? Thanks all. -- Kevin Fishburne Eight Virtues www: e-mail: phone: [1]http://www.eightvirtues.com [2]sales at ...1887... (770) 853-6271 References 1. http://www.eightvirtues.com/ 2. mailto:sales at ...1887... From mohareve at ...626... Fri Aug 6 22:59:48 2010 From: mohareve at ...626... (M. Cs.) Date: Fri, 6 Aug 2010 22:59:48 +0200 Subject: [Gambas-user] Dinamic menus and clicks Message-ID: The next question is, how can I retrieve the text of a menu item, which was created dinamicaly with PUBLIC FUNCTION FillMenu(MenuParent AS Menu, root AS String) DIM s AS String DIM hMenu AS Menu IF MenuParent.Children.Count > 0 THEN MenuParent.Children[0].Delete FOR EACH s IN Dir(root, "*", gb.directory) hMenu = NEW Menu(MenuParent) hMenu.Text = s hMenu.Picture = Picture["icon:/small/directory"] IF IsDir(MenuParent.Tag &/ s) THEN hMenu = NEW Menu(MenuParent) hMenu.Text = ".Child." ENDIF NEXT END From Gambas at ...1950... Sat Aug 7 12:22:24 2010 From: Gambas at ...1950... (Caveat) Date: Sat, 07 Aug 2010 12:22:24 +0200 Subject: [Gambas-user] Parsing a xml file from internet In-Reply-To: References: Message-ID: <1281176544.16645.115.camel@...2413...> Hi Mato, I have put together a quick demonstration project which parses a String (out of a TextArea on the Form) of XML and places the result into a TreeView (on the same Form). Attached you will find a tar file of the project, plus a screen shot. The code is based on an article I found at http://es.wikibooks.org/wiki/Gambas/Manipular_documentos_XML (Thanks and all credit to the original author!!!) I made some slight changes as the code didn't quite work in its original form with the XML as given. Regards, Caveat On Wed, 2010-08-04 at 08:50 -0300, Mat?as Manuel Grandi wrote: > Hi guys! First of all...I'm new to gambas! > I'm traying to parse a xml from > http://8tracks.com/sets/460486803/play.xml?mix_id=2000 > I can get the file with the following code: > > ' Gambas class file > PUBLIC url AS String > > PUBLIC SUB Form_Open() > DIM reader AS XmlReader > DIM h AS HttpClient > DIM buffer AS String > DIM doc AS XmlDocument > h = NEW HttpClient AS "h" > h.URL = "http://8tracks.com/sets/460486803/play.xml?mix_id=2000" > h.Async = FALSE > h.Timeout = 60 > h.Get > IF h.Status < 0 THEN > PRINT "ERROR" > ELSE > ' Success - read the data > IF Lof(h) THEN READ #h, buffer, Lof(h) > END IF > > > The xml file is now in a varaible called "buffer". How can I get it > from xmlread object? > > Thanks! > Mato.- > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot-Test Project 3 - XML.png Type: image/png Size: 97042 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TestProject3.tar.gz Type: application/x-compressed-tar Size: 10794 bytes Desc: not available URL: From gambas.fr at ...626... Sat Aug 7 12:24:50 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Sat, 7 Aug 2010 12:24:50 +0200 Subject: [Gambas-user] Dinamic menus and clicks In-Reply-To: References: Message-ID: this is the full tuto :) 2010/8/6 M. Cs. : > The next question is, how can I retrieve the text of a menu item, which was > created dinamicaly with > > PUBLIC FUNCTION FillMenu(MenuParent AS Menu, root AS String) > DIM s AS String > DIM hMenu AS Menu > > IF MenuParent.Children.Count > 0 THEN MenuParent.Children[0].Delete > > FOR EACH s IN Dir(root, "*", gb.directory) > ?hMenu = NEW Menu(MenuParent) > ?hMenu.Text = s > ?hMenu.Picture = Picture["icon:/small/directory"] > ?IF IsDir(MenuParent.Tag &/ s) THEN > ? hMenu = NEW Menu(MenuParent) > ? hMenu.Text = ".Child." > > ? ENDIF > > NEXT > END > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > -------------- next part -------------- A non-text attachment was scrubbed... Name: menudyn-0.0.1.tar.gz Type: application/x-gzip Size: 8880 bytes Desc: not available URL: From matiasgrandi at ...626... Sat Aug 7 17:17:06 2010 From: matiasgrandi at ...626... (=?UTF-8?Q?Mat=C3=ADas_Manuel_Grandi?=) Date: Sat, 7 Aug 2010 12:17:06 -0300 Subject: [Gambas-user] Parsing a xml file from internet In-Reply-To: <1281176544.16645.115.camel@...2413...> References: <1281176544.16645.115.camel@...2413...> Message-ID: 2010/8/7 Caveat > Caveat Thanks Caveat, works great! From gambas.fr at ...626... Sat Aug 7 17:32:18 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Sat, 7 Aug 2010 17:32:18 +0200 Subject: [Gambas-user] Dinamic menu structures In-Reply-To: References: <4C5C34CE.3020608@...221...> Message-ID: all is in the exemple ... try to click on one item ! Last is the key ! 2010/8/6 M. Cs. : > Another question: how to read the text of the selected menu item, which were > dinamically created? > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From matiasgrandi at ...626... Sat Aug 7 17:40:32 2010 From: matiasgrandi at ...626... (=?UTF-8?Q?Mat=C3=ADas_Manuel_Grandi?=) Date: Sat, 7 Aug 2010 12:40:32 -0300 Subject: [Gambas-user] Return an array in a function Message-ID: Hi Guys! I have a problem when calling a function, which receive an xmlreader and returns an array. The function is geturl and the error gambas give me is "Type Mismatch: Wanted an Array, got an Array instead" The code is (a bit simplified): PUBLIC SUB btnPopular_Click() DIM GetUrlFromXml AS Array xml8tracks = NEW XmlReader xml8tracks = urlDownload("http://8tracks.com/mixes.xml?sort=popular") GetUrlFromXml = GetUrl(xml8tracks) END PUBLIC FUNCTION GetUrl(reader AS XmlReader ) AS Array DIM smix[10, 4] AS String DIM id AS Integer DO WHILE TRUE TRY reader.Read () IF reader.Eof THEN BREAK IF reader.Node.Type = XmlReaderNodeType .Element THEN SELECT CASE reader.Node.Name CASE "name" id = id + 1 reader.Read () smix[id, 0] = reader.Node.Value PRINT id & "Nombre: " & smix[0, 0] CASE "restful-url" reader.Read () smix[id, 1] = reader.Node.Value PRINT id & "restful-url: " & smix[id, 1] END SELECT ENDIF LOOP reader.Close () IF ERROR THEN Message .Error ("Error when trying to open the Heroes.XML file!") RETURN ENDIF RETURN smix END Thanks! Mato.- From mohareve at ...626... Sat Aug 7 17:58:58 2010 From: mohareve at ...626... (M. Cs.) Date: Sat, 7 Aug 2010 17:58:58 +0200 Subject: [Gambas-user] Dinamic menus and clicks In-Reply-To: References: Message-ID: Thanks Fabian! With your modified example I could reach my goal! From mohareve at ...626... Sat Aug 7 18:00:51 2010 From: mohareve at ...626... (M. Cs.) Date: Sat, 7 Aug 2010 18:00:51 +0200 Subject: [Gambas-user] Return an array in a function In-Reply-To: References: Message-ID: It's not readable! Can you resend it without weblinks? From matiasgrandi at ...626... Sat Aug 7 18:25:27 2010 From: matiasgrandi at ...626... (=?UTF-8?Q?Mat=C3=ADas_Manuel_Grandi?=) Date: Sat, 7 Aug 2010 13:25:27 -0300 Subject: [Gambas-user] Return an array in a function In-Reply-To: References: Message-ID: Sorry, hi goes again!!! ----------------------------------------------------------------- Hi Guys! I have a problem when calling a function, which receive an xmlreader and returns an array. The function is geturl and the error gambas give me is?"Type Mismatch: Wanted an Array, got an Array instead" The code is (a bit simplified): PUBLIC?SUB?btnPopular_Click() ??DIM?GetUrlFromXml?AS?Array ??xml8tracks?=?NEW?XmlReader ??xml8tracks?=?urlDownload("http://8tracks.com/mixes.xml?sort=popular") ??GetUrlFromXml?=?GetUrl(xml8tracks) END PUBLIC?FUNCTION?GetUrl(reader?AS?XmlReader)?AS?Array ??DIM?smix[10, 4]?AS?String ??DIM?id?AS?Integer ??DO?WHILE?TRUE ?? ?TRY?reader.Read() ?? ?IF?reader.Eof?THEN?BREAK ?? ?IF?reader.Node.Type?=?XmlReaderNodeType.Element?THEN ?? ? ?SELECT?CASE?reader.Node.Name ?? ? ? ?CASE?"name" ?? ? ? ? ? ?id?=?id?+?1 ?? ? ? ? ? ?reader.Read() ?? ? ? ? ? ?smix[id, 0]?=?reader.Node.Value ?? ? ? ? ? ?PRINT?id?&?"Nombre: "?&?smix[0, 0] ?? ? ? ?CASE?"restful-url" ?? ? ? ? ? ?reader.Read() ?? ? ? ? ? ?smix[id, 1]?=?reader.Node.Value ?? ? ? ? ? ?PRINT?id?&?"restful-url: "?&?smix[id, 1] ?? ? ??END?SELECT ?? ?ENDIF ??LOOP ?reader.Close() ?IF?ERROR?THEN ???Message.Error("Error when trying to open the Heroes.XML file!") ???RETURN ?ENDIF ?RETURN?smix END Thanks! Mato.- 2010/8/7 M. Cs. > > It's not readable! Can you resend it without weblinks? > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user From kazutaka802 at ...1907... Sat Aug 7 21:10:53 2010 From: kazutaka802 at ...1907... (HARADA Kazutaka) Date: Sun, 08 Aug 2010 04:10:53 +0900 Subject: [Gambas-user] form.resize works only once with gb.gtk Message-ID: <4C5DAFBD.7070002@...1907...> Hi All, To restrict minimum size of form, I wrote following code. PUBLIC SUB Form_Resize() IF FMain.Height < 300 THEN FMain.Height = 300 ENDIF END But this works only once with gb.gtk. It seems 2nd and later resize method ignored.) It works fine with gb.qt. I'm running gambas-2.21.0 with gnome-2.30.2, gtk-2.20, qt-3.3.8. Possibly a bug in gb.gtk? (of course I'm not sure;) Thanks, -- -------------------------------------- Kazutaka HARADA e-mail:kazutaka802 at ...1907... -------------------------------------- From Gambas at ...1950... Sun Aug 8 13:03:03 2010 From: Gambas at ...1950... (Caveat) Date: Sun, 08 Aug 2010 13:03:03 +0200 Subject: [Gambas-user] Return an array in a function In-Reply-To: References: Message-ID: <1281265383.16645.1718.camel@...2413...> Hello again Mato I don't really get this code. Why do you set xml8tracks to new XMLReader, then immediately set it to the return from urlDownload? Where is urlDownload defined? What does it return? Where do you define xml8tracks? What is smix? Why is smix defined as String [10, 4]? Is that something you know upfront? In the "name" case, your debug could be confusing as you print that you're showing smix[id, 0] but you actually show smix[0, 0]. Please send us enough of the code that we can see what's going on and help a little more... My first tentative thought is that the odd, seemingly contradictory message "I wanted an Array but I got an Array" could be complaining because it's expecting one type of Array but getting another (so looking for a one-dimensional String Array but getting a 2-D one, or looking forRegards,classes a String Array but getting a kind of Variant one or so... ). But all that aside... I think that you need to start thinking in a more object-oriented way, so I've started you off with the changes to TestProject3 (see attached) to make it more oo. You'll notice I've added 3 classes, Response, MixUser, and Mix. The Response class holds a Collection of Mixes, the Mix class has a MixUser ... look at the procedure UseClasses on the Form to start to get an idea of how you'd need to use the classes. Create a new instance of the Response class when you get your XML, as you go through the XML and hit a new mix, create a new Mix object, when you get to a User, create a new MixUser object... when you hit the end of a Mix object, add that to the Response object... etc. etc. Sorry, I really have to go... let me know if you're still stuck!! Regards, Caveat On Sat, 2010-08-07 at 13:25 -0300, Mat?as Manuel Grandi wrote: > Sorry, hi goes again!!! > ----------------------------------------------------------------- > > Hi Guys!w > I have a problem when calling a function, which receive an xmlreader > and returns an array. > The function is geturl and the error gambas give me is "Type Mismatch: > Wanted an Array, got an Array instead" > The code is (a bit simplified): > > PUBLIC SUB btnPopular_Click() > DIM GetUrlFromXml AS Array > xml8tracks = NEW XmlReader > xml8tracks = urlDownload("http://8tracks.com/mixes.xml?sort=popular") > GetUrlFromXml = GetUrl(xml8tracks) > END > > PUBLIC FUNCTION GetUrl(reader AS XmlReader) AS Array > DIM smix[10, 4] AS String > DIM id AS Integer > > DO WHILE TRUE > TRY reader.Read() > IF reader.Eof THEN BREAK > IF reader.Node.Type = XmlReaderNodeType.Element THEN > SELECT CASE reader.Node.Name > CASE "name" > id = id + 1 > reader.Read() > smix[id, 0] = reader.Node.Value > PRINT id & "Nombre: " & smix[0, 0] > CASE "restful-url" > reader.Read() > smix[id, 1] = reader.Node.Value > PRINT id & "restful-url: " & smix[id, 1] > END SELECT > ENDIF > LOOP > reader.Close() > IF ERROR THEN > Message.Error("Error when trying to open the Heroes.XML file!") > RETURN > ENDIF > RETURN smix > END > > Thanks! > Mato.- > > > 2010/8/7 M. Cs. > > > > It's not readable! Can you resend it without weblinks? > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by > > > > Make an app they can't live without > > Enter the BlackBerry Developer Challenge > > http://p.sf.net/sfu/RIM-dev2dev > > _______________________________________________ > > Gambas-user mailing list > > Gambas-user at lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -------------- next part -------------- A non-text attachment was scrubbed... Name: TestProject3.tar.gz Type: application/x-compressed-tar Size: 16006 bytes Desc: not available URL: From charles at ...1784... Sun Aug 8 15:59:13 2010 From: charles at ...1784... (charlesg) Date: Sun, 8 Aug 2010 06:59:13 -0700 (PDT) Subject: [Gambas-user] Change Gridview.mode programmatically Message-ID: <29379998.post@...1379...> Hi I can change a gridview with mode = multiple to single with: '---------------------------- Public Sub radbutSingle_Click() GridView1.mode = 1 End '---------------------------- and it works but I cannot do it the other way round. i.e. if the mode is single then: '---------------------------- Public Sub radbutMultiple_Click() GridView1.Mode = 2 End '---------------------------- has no effect. Is this right? Mint 9, Gambas 2.19 or Gambas 3(3097), QT rgds -- View this message in context: http://old.nabble.com/Change-Gridview.mode-programmatically-tp29379998p29379998.html Sent from the gambas-user mailing list archive at Nabble.com. From charles at ...1784... Mon Aug 9 08:10:31 2010 From: charles at ...1784... (charlesg) Date: Sun, 8 Aug 2010 23:10:31 -0700 (PDT) Subject: [Gambas-user] Change Gridview.mode programmatically In-Reply-To: <29379998.post@...1379...> References: <29379998.post@...1379...> Message-ID: <29384998.post@...1379...> charlesg wrote: > > I can change a gridview with mode = multiple to single with: > '---------------------------- > Public Sub radbutSingle_Click() > GridView1.mode = 1 > End > '---------------------------- > and it works but I cannot do it the other way round. i.e. if the mode is > single then: > '---------------------------- > Public Sub radbutMultiple_Click() > GridView1.Mode = 2 > End > '---------------------------- > has no effect. Is this right? > Is it natural to make things more complicated than they need to be or is it just me?:blush::blush: I will use a multi-select gridview and treat one with only one selected line as the special case I need. thks anyway. -- View this message in context: http://old.nabble.com/Change-Gridview.mode-programmatically-tp29379998p29384998.html Sent from the gambas-user mailing list archive at Nabble.com. From mohareve at ...626... Mon Aug 9 12:05:42 2010 From: mohareve at ...626... (M. Cs.) Date: Mon, 9 Aug 2010 12:05:42 +0200 Subject: [Gambas-user] Strange MP3 playback Message-ID: I found that the MP3 files played with Gambas2 doesn't sound correctly: some of them are slower than normally, and some of them are overmodulated. Why? Solutions? From matiasgrandi at ...626... Mon Aug 9 16:30:40 2010 From: matiasgrandi at ...626... (=?UTF-8?Q?Mat=C3=ADas_Manuel_Grandi?=) Date: Mon, 9 Aug 2010 11:30:40 -0300 Subject: [Gambas-user] Return an array in a function In-Reply-To: <1281265383.16645.1718.camel@...2413...> References: <1281265383.16645.1718.camel@...2413...> Message-ID: First of all, thanks for your time and dedication!!!! Basically, I'm not too oriented to OOP because....I'm not a programmer, I'm just an economist. It's only a hobby. But the most important thing to not moving to oop, or not moving successfully, is that I started programming in basic, some scriping lenguajes, PHP...and so on. So I'm not too familiarized with oop, and I couldn't find a good manual about it (I'm sure it exists), adding that gambas documentation is very poor. BTW, your code is excelent, and shows in a clear way the benefits of OOP. So I will take the code as start point, and I'll try to improve my oop with gambas. So I will ask many questions on the list...so be patient, please!!!! Regards, Mato.- 2010/8/8 Caveat > Hello again Mato > > I don't really get this code. Why do you set xml8tracks to new > XMLReader, then immediately set it to the return from urlDownload? > > Where is urlDownload defined? What does it return? Where do you define > xml8tracks? What is smix? Why is smix defined as String [10, 4]? Is > that something you know upfront? In the "name" case, your debug could > be confusing as you print that you're showing smix[id, 0] but you > actually show smix[0, 0]. > > Please send us enough of the code that we can see what's going on and > help a little more... > > My first tentative thought is that the odd, seemingly contradictory > message "I wanted an Array but I got an Array" could be complaining > because it's expecting one type of Array but getting another (so looking > for a one-dimensional String Array but getting a 2-D one, or looking > forRegards,classes a String Array but getting a kind of Variant one or > so... ). > > But all that aside... I think that you need to start thinking in a more > object-oriented way, so I've started you off with the changes to > TestProject3 (see attached) to make it more oo. You'll notice I've > added 3 classes, Response, MixUser, and Mix. The Response class holds a > Collection of Mixes, the Mix class has a MixUser ... look at the > procedure UseClasses on the Form to start to get an idea of how you'd > need to use the classes. > > Create a new instance of the Response class when you get your XML, as > you go through the XML and hit a new mix, create a new Mix object, when > you get to a User, create a new MixUser object... when you hit the end > of a Mix object, add that to the Response object... etc. etc. > > Sorry, I really have to go... let me know if you're still stuck!! > > Regards, > Caveat > > > On Sat, 2010-08-07 at 13:25 -0300, Mat?as Manuel Grandi wrote: > > Sorry, hi goes again!!! > > ----------------------------------------------------------------- > > > > Hi Guys!w > > I have a problem when calling a function, which receive an xmlreader > > and returns an array. > > The function is geturl and the error gambas give me is "Type Mismatch: > > Wanted an Array, got an Array instead" > > The code is (a bit simplified): > > > > PUBLIC SUB btnPopular_Click() > > DIM GetUrlFromXml AS Array > > xml8tracks = NEW XmlReader > > xml8tracks = urlDownload("http://8tracks.com/mixes.xml?sort=popular") > > GetUrlFromXml = GetUrl(xml8tracks) > > END > > > > PUBLIC FUNCTION GetUrl(reader AS XmlReader) AS Array > > DIM smix[10, 4] AS String > > DIM id AS Integer > > > > DO WHILE TRUE > > TRY reader.Read() > > IF reader.Eof THEN BREAK > > IF reader.Node.Type = XmlReaderNodeType.Element THEN > > SELECT CASE reader.Node.Name > > CASE "name" > > id = id + 1 > > reader.Read() > > smix[id, 0] = reader.Node.Value > > PRINT id & "Nombre: " & smix[0, 0] > > CASE "restful-url" > > reader.Read() > > smix[id, 1] = reader.Node.Value > > PRINT id & "restful-url: " & smix[id, 1] > > END SELECT > > ENDIF > > LOOP > > reader.Close() > > IF ERROR THEN > > Message.Error("Error when trying to open the Heroes.XML file!") > > RETURN > > ENDIF > > RETURN smix > > END > > > > Thanks! > > Mato.- > > > > > > 2010/8/7 M. Cs. > > > > > > It's not readable! Can you resend it without weblinks? > > > > ------------------------------------------------------------------------------ > > > This SF.net email is sponsored by > > > > > > Make an app they can't live without > > > Enter the BlackBerry Developer Challenge > > > http://p.sf.net/sfu/RIM-dev2dev > > > _______________________________________________ > > > Gambas-user mailing list > > > Gambas-user at lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by > > > > Make an app they can't live without > > Enter the BlackBerry Developer Challenge > > http://p.sf.net/sfu/RIM-dev2dev > > _______________________________________________ > > Gambas-user mailing list > > Gambas-user at lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > > From rterry at ...1946... Tue Aug 10 06:47:34 2010 From: rterry at ...1946... (richard terry) Date: Tue, 10 Aug 2010 14:47:34 +1000 Subject: [Gambas-user] pdf orientation Message-ID: <201008101447.34854.rterry@...1946...> I noticed there is an orientation property for the pdf, but ?how to use this. Is there any automatic way to detect if the orientation of a doc is landscape? Regards Richard From austinium at ...43... Wed Aug 11 08:53:42 2010 From: austinium at ...43... (vikram) Date: Tue, 10 Aug 2010 23:53:42 -0700 (PDT) Subject: [Gambas-user] Me.Close in a multi-form application Message-ID: <626305.73655.qm@...2469...> hi, i have a multiform application, on the Close event of each form a confirmation dialog is displayed. The user clicks a button on each form to move to the next one(or clicks a button to go back to the previous form), when he/she does this the current form's Visible property is set to false and that of the desired form is set to true. When the user exits the application, Me.Close would only close the current form and all previous forms would remain in memory. I remember reading from the documentation that QUIT should not be used in GUI applications. If i close all previously opened forms by using FormName.Close each form's confirmation dialog pops up. I've been thinking of way out of this, the only idea i've been able to come up with is that if there is a way a function could tell who called it, i could use that to prevent the confirmation dialogs from being displayed on form close. Say user closes Form C, now Forms A & B are have their Visible property set to False so they are hidden. On the Close event of Form C i call Form A,B & C's Close method. If Form A & B's Close method could tell that they've been called from another form, then maybe i could prevent the confirmation dialogs from popping up. Or could there be some other way to do this? I have a attached a sample application which illustrates the problem. Thanks in advance :) Vikram Shankar Nair -------------- next part -------------- A non-text attachment was scrubbed... Name: multiformClose.tar.gz Type: application/x-gzip Size: 9028 bytes Desc: not available URL: From bbruen at ...2308... Wed Aug 11 10:38:37 2010 From: bbruen at ...2308... (Bruce Bruen) Date: Wed, 11 Aug 2010 18:08:37 +0930 Subject: [Gambas-user] Me.Close in a multi-form application In-Reply-To: <626305.73655.qm@...2469...> References: <626305.73655.qm@...2469...> Message-ID: <201008111808.38585.bbruen@...2308...> Hi Vikram, There are probably much better ways to do what you are trying to do, but its hard to suggest them fro the sample. But for a quick answer: PUBLIC SUB Form_Close() DIM retval AS Integer IF NOT ME.Visible THEN ME.Close RETURN ENDIF retval = Message.Question("Are you sure you want to exit FormA?", "Yes", "No") IF retval = 1 ME.Close ELSE STOP EVENT END IF END -- best regards Bruce Bruen From math.eber at ...221... Wed Aug 11 21:13:54 2010 From: math.eber at ...221... (Matti) Date: Wed, 11 Aug 2010 21:13:54 +0200 Subject: [Gambas-user] Help Browser in Gambas3 Message-ID: <4C62F672.1020300@...221...> Hi, the help system now is much better then in Gambas2. But one thing: the Type property of the help browser is set to "Utility". This way, the window can't be minimized, which is silly. I read the help, have to close, type something, have forgot, have to open again, have to close... This is annoying! Regards Matti From kevinfishburne at ...1887... Thu Aug 12 00:05:52 2010 From: kevinfishburne at ...1887... (kevinfishburne) Date: Wed, 11 Aug 2010 15:05:52 -0700 (PDT) Subject: [Gambas-user] gb.image: how to keep a rotated image centered In-Reply-To: References: <29356475.post@...1379...> Message-ID: <29413377.post@...1379...> Jussi Lahtinen wrote: > > There is probably more efficient ways, but quick and dirty... > Great minds must think alike. I didn't receive a notification email about your post for some reason, but independently developed the same code almost exactly. Crazy, huh? Your code (and my code) do the trick nicely. Here's mine: http://old.nabble.com/file/p29413377/gb.image_rotate.tar.bz2 gb.image_rotate.tar.bz2 PUBLIC SUB Form_Open() ' General declarations. DIM bg_normal AS Image = Image.Load("grass.png") DIM bg_rotated AS Image DIM bg_cropped AS Image DIM f AS Float DIM t AS Float DIM frames AS Integer ' Assign initial values to variables. DrawingArea.Height = Desktop.Height DrawingArea.Width = Desktop.Width ' Rotate the background and update the drawing area. FMain.Show t = Timer FOR f = 0 TO 6.2831853 * 1 STEP 0.01 bg_rotated = bg_normal.Rotate(f) bg_cropped = bg_rotated.Copy((bg_rotated.Width - 1024) / 2, (bg_rotated.Height - 1024) / 2, 1024, 1024) Draw.Begin(DrawingArea) Draw.Image(bg_cropped, 0, 0) Draw.End frames = frames + 1 WAIT NEXT ' Display frames per second rendered. PRINT frames / (Timer - t) & " frames per second" ' End the program. QUIT END ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:sales at ...1887... sales at ...1887... phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-how-to-keep-a-rotated-image-centered-tp29369608p29413377.html Sent from the gambas-user mailing list archive at Nabble.com. From kevinfishburne at ...1887... Thu Aug 12 00:30:25 2010 From: kevinfishburne at ...1887... (kevinfishburne) Date: Wed, 11 Aug 2010 15:30:25 -0700 (PDT) Subject: [Gambas-user] gb.image: image alpha channel accessibility Message-ID: <29413575.post@...1379...> I'm writing a game and am exploring my graphical options using gb.image. While it's not hardware accelerated, it's easier to get into than OpenGL and the SDL component seems to be missing key features such as image rotation. The various filter/effect methods also offer a huge range of possibilities, CPU speed permitting. The GAMBAS documentation states that images in gb.image are treated as read/write arrays, which I'm assuming means that they're allocated in memory similarly and that their elements are accessed similarly. .Load, .Copy and .Draw operate on the alpha channel and RGB channel together, but I don't see any way to read or write to an image's alpha channel exclusively. Is this possible, and if so, how? If the only available method is something like getting the pointer to where the image is stored in memory and accessing it one pixel at a time, it might be a good idea to expand the existing gb.image methods to include performing operations specifically on the alpha channel. This could also be accomplished by allowing all the existing methods to work directly on the alpha channel, such as .Copy and .Draw. As always, any ideas or reflections are appreciated. ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:sales at ...1887... sales at ...1887... phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-image-alpha-channel-accessibility-tp29413575p29413575.html Sent from the gambas-user mailing list archive at Nabble.com. From gambas at ...1... Thu Aug 12 00:35:27 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Thu, 12 Aug 2010 00:35:27 +0200 Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <29413575.post@...1379...> References: <29413575.post@...1379...> Message-ID: <201008120035.28033.gambas@...1...> > I'm writing a game and am exploring my graphical options using gb.image. > While it's not hardware accelerated, it's easier to get into than OpenGL > and the SDL component seems to be missing key features such as image > rotation. The various filter/effect methods also offer a huge range of > possibilities, CPU speed permitting. > > The GAMBAS documentation states that images in gb.image are treated as > read/write arrays, which I'm assuming means that they're allocated in > memory similarly and that their elements are accessed similarly. .Load, > .Copy and .Draw operate on the alpha channel and RGB channel together, but > I don't see any way to read or write to an image's alpha channel > exclusively. Is this possible, and if so, how? > > If the only available method is something like getting the pointer to where > the image is stored in memory and accessing it one pixel at a time, it > might be a good idea to expand the existing gb.image methods to include > performing operations specifically on the alpha channel. This could also > be > accomplished by allowing all the existing methods to work directly on the > alpha channel, such as .Copy and .Draw. > > As always, any ideas or reflections are appreciated. > > ----- > Kevin Fishburne, Eight Virtues > www: http://sales.eightvirtues.com http://sales.eightvirtues.com > e-mail: mailto:sales at ...1887... sales at ...1887... > phone: (770) 853-6271 - There is no rotation in gb.image because I don't have the algorithm at the moment. It is a bit complex, because all gb.image color formats should be supported. - The alpha channel is the highest byte of the 4-bytes pixel color. What do you want to do with the alpha channel? -- Beno?t Minisini From kevinfishburne at ...1887... Thu Aug 12 01:16:26 2010 From: kevinfishburne at ...1887... (kevinfishburne) Date: Wed, 11 Aug 2010 16:16:26 -0700 (PDT) Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <201008120035.28033.gambas@...1...> References: <29413575.post@...1379...> <201008120035.28033.gambas@...1...> Message-ID: <29413824.post@...1379...> Beno?t Minisini wrote: > > - There is no rotation in gb.image because I don't have the algorithm at > the > moment. It is a bit complex, because all gb.image color formats should be > supported. > Did you mean the SDL component? gb.image does have rotation (although I don't know if it preserves the alpha channel): http://gambasdoc.org/help/comp/gb.qt/image/rotate http://old.nabble.com/gb.image:-how-to-keep-a-rotated-image-centered-td29369608.html Beno?t Minisini wrote: > > - The alpha channel is the highest byte of the 4-bytes pixel color. What > do > you want to do with the alpha channel? > Thanks, that is good to know. Briefly, I'd like to copy the alpha channel from one image to the alpha channel of another image, preserving the target RGB channel. It would be like using Image.Draw but being able to specify the source channel[s] (RGB, Alpha, All) and destination channel[s] (RGB, Alpha, All). Specifically, the game I'm writing uses a layered landscape (bedrock, sand, soil, vegetation, snow) with one large tileable texture for each layer. As each layer is rendered it needs to be seamlessly blended with the other layers using smaller alpha channel images. The smaller images used only for their alpha channel are "interconnective" or "in-between" tiles and create a smooth transition between, for example, sand and grass tiles. I could address the pixels individually, but that would be super inefficient as opposed to using a GAMBAS method with its underlying C code's speed. I'm probably pushing GAMBAS in a direction it wasn't meant to go, but nevertheless that would be a damn useful functionality for games and graphics apps. Let me know what you think, and here's my web site if you're curious: http://www.eightvirtues.com/sanctimonia ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:sales at ...1887... sales at ...1887... phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-image-alpha-channel-accessibility-tp29413575p29413824.html Sent from the gambas-user mailing list archive at Nabble.com. From gambas at ...1... Thu Aug 12 01:34:21 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Thu, 12 Aug 2010 01:34:21 +0200 Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <29413824.post@...1379...> References: <29413575.post@...1379...> <201008120035.28033.gambas@...1...> <29413824.post@...1379...> Message-ID: <201008120134.21698.gambas@...1...> > Beno?t Minisini wrote: > > - There is no rotation in gb.image because I don't have the algorithm at > > the > > moment. It is a bit complex, because all gb.image color formats should be > > supported. > > Did you mean the SDL component? gb.image does have rotation (although I > don't know if it preserves the alpha channel): > > http://gambasdoc.org/help/comp/gb.qt/image/rotate > http://old.nabble.com/gb.image:-how-to-keep-a-rotated-image-centered-td2936 > 9608.html > > Beno?t Minisini wrote: > > - The alpha channel is the highest byte of the 4-bytes pixel color. What > > do > > you want to do with the alpha channel? > > Thanks, that is good to know. Briefly, I'd like to copy the alpha channel > from one image to the alpha channel of another image, preserving the target > RGB channel. It would be like using Image.Draw but being able to specify > the source channel[s] (RGB, Alpha, All) and destination channel[s] (RGB, > Alpha, All). > > Specifically, the game I'm writing uses a layered landscape (bedrock, sand, > soil, vegetation, snow) with one large tileable texture for each layer. As > each layer is rendered it needs to be seamlessly blended with the other > layers using smaller alpha channel images. The smaller images used only for > their alpha channel are "interconnective" or "in-between" tiles and create > a smooth transition between, for example, sand and grass tiles. > > I could address the pixels individually, but that would be super > inefficient as opposed to using a GAMBAS method with its underlying C > code's speed. I'm probably pushing GAMBAS in a direction it wasn't meant > to go, but > nevertheless that would be a damn useful functionality for games and > graphics apps. > > Let me know what you think, and here's my web site if you're curious: > > http://www.eightvirtues.com/sanctimonia > > ----- > Kevin Fishburne, Eight Virtues > www: http://sales.eightvirtues.com http://sales.eightvirtues.com > e-mail: mailto:sales at ...1887... sales at ...1887... > phone: (770) 853-6271 I'm not sure to really understand. Would you make some images for me? -- Beno?t Minisini From kevinfishburne at ...1887... Thu Aug 12 03:10:25 2010 From: kevinfishburne at ...1887... (kevinfishburne) Date: Wed, 11 Aug 2010 18:10:25 -0700 (PDT) Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <201008120134.21698.gambas@...1...> References: <29413575.post@...1379...> <201008120035.28033.gambas@...1...> <29413824.post@...1379...> <201008120134.21698.gambas@...1...> Message-ID: <29414425.post@...1379...> Beno?t Minisini wrote: > > I'm not sure to really understand. Would you make some images for me? > It took me a while to hand make this in GIMP, but here's the idea: http://www.eightvirtues.com/misc/alpha_stuff.xcf There are eight tiles that use only alpha (ten if you include fully opaque and fully transparent), which are applied to a larger texture to make parts of it transparent to expose the underlying layers. In the GIMP file the eight tiles' alpha channels have been applied to the grass layer, effectively removing the undesired parts of it to expose the sand layer. Basically, copying only the alpha channel of an image to the alpha channel of another image opens up all kinds of graphical possibilities. The alpha channel is one of the few things that can make 2D graphics look great, whether used normally or creatively. ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:sales at ...1887... sales at ...1887... phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-image-alpha-channel-accessibility-tp29413575p29414425.html Sent from the gambas-user mailing list archive at Nabble.com. From gambas at ...1... Thu Aug 12 10:42:22 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Thu, 12 Aug 2010 10:42:22 +0200 Subject: [Gambas-user] Help Browser in Gambas3 In-Reply-To: <4C62F672.1020300@...221...> References: <4C62F672.1020300@...221...> Message-ID: <201008121042.22809.gambas@...1...> > Hi, > > the help system now is much better then in Gambas2. > But one thing: the Type property of the help browser is set to "Utility". > This way, the window can't be minimized, which is silly. I read the help, > have to close, type something, have forgot, have to open again, have to > close... This is annoying! > > Regards > Matti > I have configured the KDE window manager to roll/unroll windows when using the mouse wheel on the window title bar. That way, I can hide the search window and unhide it easily. But I understand your problem, and maybe I can add an option for that... -- Beno?t Minisini From gambas at ...1... Thu Aug 12 21:14:43 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Thu, 12 Aug 2010 21:14:43 +0200 Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <29414425.post@...1379...> References: <29413575.post@...1379...> <201008120134.21698.gambas@...1...> <29414425.post@...1379...> Message-ID: <201008122114.43582.gambas@...1...> > Beno?t Minisini wrote: > > I'm not sure to really understand. Would you make some images for me? > > It took me a while to hand make this in GIMP, but here's the idea: > > http://www.eightvirtues.com/misc/alpha_stuff.xcf > > There are eight tiles that use only alpha (ten if you include fully opaque > and fully transparent), which are applied to a larger texture to make parts > of it transparent to expose the underlying layers. In the GIMP file the > eight tiles' alpha channels have been applied to the grass layer, > effectively removing the undesired parts of it to expose the sand layer. > > Basically, copying only the alpha channel of an image to the alpha channel > of another image opens up all kinds of graphical possibilities. The alpha > channel is one of the few things that can make 2D graphics look great, > whether used normally or creatively. > > ----- > Kevin Fishburne, Eight Virtues > www: http://sales.eightvirtues.com http://sales.eightvirtues.com > e-mail: mailto:sales at ...1887... sales at ...1887... > phone: (770) 853-6271 I made an Image.DrawAlpha() method for you in revision #3101. Tell me if this is was you need. Regards, -- Beno?t Minisini From gambas at ...1... Thu Aug 12 23:02:38 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Thu, 12 Aug 2010 23:02:38 +0200 Subject: [Gambas-user] KDE 4.5 / Mandriva 2010.1 / Gambas Message-ID: <201008122302.38813.gambas@...1...> Just a warning for Mandriva users... If you install KDE 4.5 packages on Mandriva 2010.1, then you won't be able to compile the Qt4 component, because a file in the qt4-devel package has a bug. The bad file is named "libQtWebKit.la" and is located in /usr/lib (or /usr/lib64 on 64 bits systems). I join a fixed libQtWebKit.la so that everything compiles correctly! Regards, -- Beno?t Minisini -------------- next part -------------- A non-text attachment was scrubbed... Name: libQtWebKit.la Type: application/x-shared-library-la Size: 1062 bytes Desc: not available URL: From david.villalobos.c at ...626... Thu Aug 12 23:46:35 2010 From: david.villalobos.c at ...626... (David Villalobos Cambronero) Date: Thu, 12 Aug 2010 15:46:35 -0600 Subject: [Gambas-user] KDE 4.5 / Mandriva 2010.1 / Gambas In-Reply-To: <201008122302.38813.gambas@...1...> References: <201008122302.38813.gambas@...1...> Message-ID: Thanks!! Gracias --- David 2010/8/12 Beno?t Minisini > Just a warning for Mandriva users... > > If you install KDE 4.5 packages on Mandriva 2010.1, then you won't be able > to > compile the Qt4 component, because a file in the qt4-devel package has a > bug. > > The bad file is named "libQtWebKit.la" and is located in /usr/lib (or > /usr/lib64 on 64 bits systems). > > I join a fixed libQtWebKit.la so that everything compiles correctly! > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > > From kevinfishburne at ...1887... Fri Aug 13 00:44:40 2010 From: kevinfishburne at ...1887... (kevinfishburne) Date: Thu, 12 Aug 2010 15:44:40 -0700 (PDT) Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <201008122114.43582.gambas@...1...> References: <29413575.post@...1379...> <201008120035.28033.gambas@...1...> <29413824.post@...1379...> <201008120134.21698.gambas@...1...> <29414425.post@...1379...> <201008122114.43582.gambas@...1...> Message-ID: <29424022.post@...1379...> Beno?t Minisini wrote: > > I made an Image.DrawAlpha() method for you in revision #3101. Tell me if > this > is was you need. > Am compiling now and will run test code using the new method to produce tiling with different layers. Thank you so much. I'll post my code when I get a proof-of-concept sample working. Awesome! =) ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:sales at ...1887... sales at ...1887... phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-image-alpha-channel-accessibility-tp29413575p29424022.html Sent from the gambas-user mailing list archive at Nabble.com. From gambas at ...1... Fri Aug 13 22:12:58 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Fri, 13 Aug 2010 22:12:58 +0200 Subject: [Gambas-user] pdf orientation In-Reply-To: <201008101447.34854.rterry@...1946...> References: <201008101447.34854.rterry@...1946...> Message-ID: <201008132212.58527.gambas@...1...> > I noticed there is an orientation property for the pdf, but ?how to use > this. The Orientation property takes one of the following values: PdfDocument.Normal PdfDocument.Sideways PdfDocument.Inverted PdfDocument.SidewaysInverted > Is there any automatic way to detect if the orientation of a doc is > landscape? The only way I see is testing the dimensions of the page. Regards, -- Beno?t Minisini From jussi.lahtinen at ...626... Sat Aug 14 19:55:43 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Sat, 14 Aug 2010 20:55:43 +0300 Subject: [Gambas-user] Signal 11 from programming error Message-ID: Hi! I had error in way I calculated position in array, and it revealed error in it's handling. Way to reproduce problem: Private aa As New Integer[] Public Sub Form_Open() aa.Fill(1, -1, 1) End gdb outputs: (gdb) run Starting program: /usr/local/bin/gbx3 -p [Thread debugging using libthread_db enabled] Program received signal SIGSEGV, Segmentation fault. 0x00000000004072d0 in VALUE_write (value=0x659518, addr=0x0, type=4) at gbx_value.c:816 816 *((int *)addr) = value->_integer.value; (gdb) bt #0 0x00000000004072d0 in VALUE_write (value=0x659518, addr=0x0, type=4) at gbx_value.c:816 #1 0x000000000042884a in CARRAY_fill (_object=0x782508, _param=) at gbx_c_array.c:776 #2 0x000000000040988d in EXEC_native () at gbx_exec.c:1241 #3 0x000000000042f789 in EXEC_loop () at gbx_exec_loop.c:970 #4 0x0000000000409db6 in EXEC_function_loop () at gbx_exec.c:858 #5 0x000000000040a809 in EXEC_function_real () at gbx_exec.c:845 #6 0x000000000041c20c in raise_event (observer=, object=, func_id=, nparam=6657304) at gbx_api.c:483 #7 0x000000000041c9e7 in GB_Raise (object=0x77fa28, event_id=, nparam=0) at gbx_api.c:583 #8 0x00007ffff6b44d73 in gMainWindow::emitOpen (this=0x77faf0) at gmainwindow.cpp:417 #9 0x00007ffff6b45ca4 in gMainWindow::setVisible (this=0x77faf0, vl=false) at gmainwindow.cpp:442 #10 0x000000000040988d in EXEC_native () at gbx_exec.c:1241 #11 0x000000000040b32d in EXEC_public_desc (class=0x659518, object=0x0, desc=0x4, nparam=) at gbx_exec.c:1485 #12 0x0000000000421d2e in main (argc=1, argv=) at gbx.c:359 Gambas 3 revision 3109 @ Ubuntu 10.04 64bit Jussi From jussi.lahtinen at ...626... Sat Aug 14 22:23:21 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Sat, 14 Aug 2010 23:23:21 +0300 Subject: [Gambas-user] Bug affecting to ShowModal Message-ID: Hi! If form is invoked with ShowModal in certain situation it prevents form to close --> hang. See attached project. Gambas 3 revision 3109 @ Ubuntu 10.04 64bit Jussi -------------- next part -------------- A non-text attachment was scrubbed... Name: FormTest-0.0.1.tar.gz Type: application/x-gzip Size: 4905 bytes Desc: not available URL: From gambas at ...1... Sat Aug 14 22:52:09 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sat, 14 Aug 2010 22:52:09 +0200 Subject: [Gambas-user] Signal 11 from programming error In-Reply-To: References: Message-ID: <201008142252.09820.gambas@...1...> > Hi! > I had error in way I calculated position in array, and it revealed > error in it's handling. > Way to reproduce problem: > > Private aa As New Integer[] > > Public Sub Form_Open() > aa.Fill(1, -1, 1) > End > > gdb outputs: > > (gdb) run > Starting program: /usr/local/bin/gbx3 -p > [Thread debugging using libthread_db enabled] > > Program received signal SIGSEGV, Segmentation fault. > 0x00000000004072d0 in VALUE_write (value=0x659518, addr=0x0, type=4) > at gbx_value.c:816 > 816 *((int *)addr) = value->_integer.value; > > > (gdb) bt > #0 0x00000000004072d0 in VALUE_write (value=0x659518, addr=0x0, type=4) > at gbx_value.c:816 > #1 0x000000000042884a in CARRAY_fill (_object=0x782508, > _param=) at gbx_c_array.c:776 > #2 0x000000000040988d in EXEC_native () at gbx_exec.c:1241 > #3 0x000000000042f789 in EXEC_loop () at gbx_exec_loop.c:970 > #4 0x0000000000409db6 in EXEC_function_loop () at gbx_exec.c:858 > #5 0x000000000040a809 in EXEC_function_real () at gbx_exec.c:845 > #6 0x000000000041c20c in raise_event (observer=, > object=, func_id=, > nparam=6657304) at gbx_api.c:483 > #7 0x000000000041c9e7 in GB_Raise (object=0x77fa28, > event_id=, nparam=0) at gbx_api.c:583 > #8 0x00007ffff6b44d73 in gMainWindow::emitOpen (this=0x77faf0) > at gmainwindow.cpp:417 > #9 0x00007ffff6b45ca4 in gMainWindow::setVisible (this=0x77faf0, vl=false) > at gmainwindow.cpp:442 > #10 0x000000000040988d in EXEC_native () at gbx_exec.c:1241 > #11 0x000000000040b32d in EXEC_public_desc (class=0x659518, object=0x0, > desc=0x4, nparam=) at gbx_exec.c:1485 > #12 0x0000000000421d2e in main (argc=1, argv=) > at gbx.c:359 > > > Gambas 3 revision 3109 @ Ubuntu 10.04 64bit > > Jussi > Thanks. That should be fixed in revision #3110. Regards, -- Beno?t Minisini From jussi.lahtinen at ...626... Sat Aug 14 23:28:27 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Sun, 15 Aug 2010 00:28:27 +0300 Subject: [Gambas-user] Signal 11 from programming error In-Reply-To: <201008142252.09820.gambas@...1...> References: <201008142252.09820.gambas@...1...> Message-ID: Works correctly now. Jussi 2010/8/14 Beno?t Minisini : >> Hi! >> I had error in way I calculated position in array, and it revealed >> error in it's handling. >> Way to reproduce problem: >> >> Private aa As New Integer[] >> >> Public Sub Form_Open() >> aa.Fill(1, -1, 1) >> End >> >> gdb outputs: >> >> (gdb) run >> Starting program: /usr/local/bin/gbx3 -p >> [Thread debugging using libthread_db enabled] >> >> Program received signal SIGSEGV, Segmentation fault. >> 0x00000000004072d0 in VALUE_write (value=0x659518, addr=0x0, type=4) >> ? ? at gbx_value.c:816 >> 816 ? ? ? ? ? *((int *)addr) = value->_integer.value; >> >> >> (gdb) bt >> #0 ?0x00000000004072d0 in VALUE_write (value=0x659518, addr=0x0, type=4) >> ? ? at gbx_value.c:816 >> #1 ?0x000000000042884a in CARRAY_fill (_object=0x782508, >> ? ? _param=) at gbx_c_array.c:776 >> #2 ?0x000000000040988d in EXEC_native () at gbx_exec.c:1241 >> #3 ?0x000000000042f789 in EXEC_loop () at gbx_exec_loop.c:970 >> #4 ?0x0000000000409db6 in EXEC_function_loop () at gbx_exec.c:858 >> #5 ?0x000000000040a809 in EXEC_function_real () at gbx_exec.c:845 >> #6 ?0x000000000041c20c in raise_event (observer=, >> ? ? object=, func_id=, >> ? ? nparam=6657304) at gbx_api.c:483 >> #7 ?0x000000000041c9e7 in GB_Raise (object=0x77fa28, >> ? ? event_id=, nparam=0) at gbx_api.c:583 >> #8 ?0x00007ffff6b44d73 in gMainWindow::emitOpen (this=0x77faf0) >> ? ? at gmainwindow.cpp:417 >> #9 ?0x00007ffff6b45ca4 in gMainWindow::setVisible (this=0x77faf0, vl=false) >> ? ? at gmainwindow.cpp:442 >> #10 0x000000000040988d in EXEC_native () at gbx_exec.c:1241 >> #11 0x000000000040b32d in EXEC_public_desc (class=0x659518, object=0x0, >> ? ? desc=0x4, nparam=) at gbx_exec.c:1485 >> #12 0x0000000000421d2e in main (argc=1, argv=) >> ? ? at gbx.c:359 >> >> >> Gambas 3 revision 3109 @ Ubuntu 10.04 64bit >> >> Jussi >> > > Thanks. That should be fixed in revision #3110. > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From gambas at ...1... Sat Aug 14 23:45:29 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sat, 14 Aug 2010 23:45:29 +0200 Subject: [Gambas-user] Bug affecting to ShowModal In-Reply-To: References: Message-ID: <201008142345.29685.gambas@...1...> > Hi! > If form is invoked with ShowModal in certain situation it prevents > form to close --> hang. > See attached project. > > Gambas 3 revision 3109 @ Ubuntu 10.04 64bit > > Jussi And that one is fixed in revision #3111. Regards, -- Beno?t Minisini From jussi.lahtinen at ...626... Sun Aug 15 00:18:16 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Sun, 15 Aug 2010 01:18:16 +0300 Subject: [Gambas-user] Bug affecting to ShowModal In-Reply-To: <201008142345.29685.gambas@...1...> References: <201008142345.29685.gambas@...1...> Message-ID: Unfortunately not entirely. "Invalid object" from next showmodal form invoke. See attached project. Jussi 2010/8/15 Beno?t Minisini : >> Hi! >> If form is invoked with ShowModal in certain situation it prevents >> form to close --> hang. >> See attached project. >> >> Gambas 3 revision 3109 @ Ubuntu 10.04 64bit >> >> Jussi > > And that one is fixed in revision #3111. > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > -------------- next part -------------- A non-text attachment was scrubbed... Name: FormTest-0.0.2.tar.gz Type: application/x-gzip Size: 5076 bytes Desc: not available URL: From dag.jarle.johansen at ...2312... Sun Aug 15 01:35:13 2010 From: dag.jarle.johansen at ...2312... (Dag Jarle Johansen) Date: Sat, 14 Aug 2010 20:35:13 -0300 Subject: [Gambas-user] SVN and Distribution Message-ID: Hi all. I will have to distribute a little programm, so I will have to install Gambas 2.x too, I asume. My question is: Will there be any conflicts between the SVN for Gambas 3.x rev. 3098 and a new installation of 2.x? I will mainly dewvelop with the SVN, so I'd rather seek another solution than to mess up a working environment. Thanks and regards, Dag-Jarle Johansen From prog at ...2177... Sun Aug 15 04:13:06 2010 From: prog at ...2177... (craf) Date: Sat, 14 Aug 2010 22:13:06 -0400 Subject: [Gambas-user] Error in example MoviePlayer in Gambas 3 Message-ID: <1281838386.5147.2.camel@...2406...> Hi. When I try to run the sample MoviePlayer, gives me this error: Wid = 4400040 (MoviePlayer:5144): Gtk-CRITICAL **: gtk_widget_set_events: assertion `! GTK_WIDGET_REALIZED (widget)' failed This error occurs by GNOME canvas control? Regards From gambas at ...1... Sun Aug 15 12:00:54 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 15 Aug 2010 12:00:54 +0200 Subject: [Gambas-user] SVN and Distribution In-Reply-To: References: Message-ID: <201008151200.54593.gambas@...1...> > Hi all. > > I will have to distribute a little programm, so I will have to install > Gambas 2.x too, I asume. My question is: Will there be any conflicts > between the SVN for Gambas 3.x rev. 3098 and a new installation of 2.x? > I will mainly dewvelop with the SVN, so I'd rather seek another solution > than to mess up a working environment. > > Thanks and regards, > Dag-Jarle Johansen > > Gambas 2 and Gambas 3 are installed in their own directory, and the files installed in common directories (like /usr/bin or /usr/local/bin) are named differently. So you can have them both on your machine. How could I do otherwise? :-) -- Beno?t Minisini From gambas at ...1... Sun Aug 15 13:02:26 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 15 Aug 2010 13:02:26 +0200 Subject: [Gambas-user] Error in example MoviePlayer in Gambas 3 In-Reply-To: <1281838386.5147.2.camel@...2406...> References: <1281838386.5147.2.camel@...2406...> Message-ID: <201008151302.26362.gambas@...1...> > Hi. > > When I try to run the sample MoviePlayer, gives me this error: > > Wid = 4400040 > > (MoviePlayer:5144): Gtk-CRITICAL **: gtk_widget_set_events: assertion `! > GTK_WIDGET_REALIZED (widget)' failed > > This error occurs by GNOME canvas control? > > Regards > Fixed in revision #3116. Regards, -- Beno?t Minisini From jussi.lahtinen at ...626... Sun Aug 15 14:51:56 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Sun, 15 Aug 2010 15:51:56 +0300 Subject: [Gambas-user] Bug affecting to ShowModal In-Reply-To: References: <201008142345.29685.gambas@...1...> Message-ID: There seems to be workaround for this bug. Instead of this: Public Form1 As New FForm1 Public Form2 As New FForm2 Public Sub Main() If Form1.ShowModal() = 666 Then Form2.ShowModal() Endif End This works: Public Form1 As New FForm1 Public Form2 As FForm2 Public Sub Main() If Form1.ShowModal() = 666 Then Form2 = New FForm2 Form2.ShowModal() Endif End At least this workaround works with revision 3117. Jussi On Sun, Aug 15, 2010 at 01:18, Jussi Lahtinen wrote: > Unfortunately not entirely. > "Invalid object" from next showmodal form invoke. > See attached project. > > Jussi > > > 2010/8/15 Beno?t Minisini : >>> Hi! >>> If form is invoked with ShowModal in certain situation it prevents >>> form to close --> hang. >>> See attached project. >>> >>> Gambas 3 revision 3109 @ Ubuntu 10.04 64bit >>> >>> Jussi >> >> And that one is fixed in revision #3111. >> >> Regards, >> >> -- >> Beno?t Minisini >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by >> >> Make an app they can't live without >> Enter the BlackBerry Developer Challenge >> http://p.sf.net/sfu/RIM-dev2dev >> _______________________________________________ >> Gambas-user mailing list >> Gambas-user at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-user >> > From gambas at ...1... Sun Aug 15 14:57:54 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 15 Aug 2010 14:57:54 +0200 Subject: [Gambas-user] Bug affecting to ShowModal In-Reply-To: References: Message-ID: <201008151457.54889.gambas@...1...> > There seems to be workaround for this bug. > Instead of this: > > Public Form1 As New FForm1 > Public Form2 As New FForm2 > > Public Sub Main() > > If Form1.ShowModal() = 666 Then > Form2.ShowModal() > Endif > > End > > > This works: > > Public Form1 As New FForm1 > Public Form2 As FForm2 > > Public Sub Main() > > If Form1.ShowModal() = 666 Then > Form2 = New FForm2 > Form2.ShowModal() > Endif > > End > > At least this workaround works with revision 3117. > > Jussi > Gambas decides that the first shown window is the "main" window, and that closing it closes all other ones. So when Form1.ShowModal() returns, Form2 has been destroyed, and you get an "invalid" object. Regards, -- Beno?t Minisini From jussi.lahtinen at ...626... Sun Aug 15 15:47:34 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Sun, 15 Aug 2010 16:47:34 +0300 Subject: [Gambas-user] Bug affecting to ShowModal In-Reply-To: <201008151457.54889.gambas@...1...> References: <201008151457.54889.gambas@...1...> Message-ID: Yes, after I wrote my mail, I figured it may be the case. Problem is that my program is oriented to module. It invokes forms when needed and shows with them what happens inside of module. Project I'm working on is big, old and messy. It is ported from vb6. Now I'm trying to make code more clear, but I'm getting signal 11. I can't send this project to you, but I'm trying to isolate the problem. Do gdb outputs help you without source code? However, here: Program received signal SIGSEGV, Segmentation fault. my_free (alloc=0x1e1d150a1e1d150a) at ../share/gb_alloc_temp.h:333 333 pool = (size / SIZE_INC) - 1; (gdb) bt #0 my_free (alloc=0x1e1d150a1e1d150a) at ../share/gb_alloc_temp.h:333 #1 0x000000000042b6ef in EXTERN_exit () at gbx_extern.c:438 #2 0x00000000004216ae in main_exit (silent=) at gbx.c:135 #3 0x0000000000421e0f in main (argc=1, argv=) at gbx.c:391 Jussi 2010/8/15 Beno?t Minisini : >> There seems to be workaround for this bug. >> Instead of this: >> >> Public Form1 As New FForm1 >> Public Form2 As New FForm2 >> >> Public Sub Main() >> >> ? If Form1.ShowModal() = 666 Then >> ? Form2.ShowModal() >> ? Endif >> >> End >> >> >> This works: >> >> Public Form1 As New FForm1 >> Public Form2 As FForm2 >> >> Public Sub Main() >> >> ? If Form1.ShowModal() = 666 Then >> ? Form2 = New FForm2 >> ? Form2.ShowModal() >> ? Endif >> >> End >> >> At least this workaround works with revision 3117. >> >> Jussi >> > > Gambas decides that the first shown window is the "main" window, and that > closing it closes all other ones. > > So when Form1.ShowModal() returns, Form2 has been destroyed, and you get an > "invalid" object. > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From gambas at ...1... Sun Aug 15 16:01:19 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 15 Aug 2010 16:01:19 +0200 Subject: [Gambas-user] Bug affecting to ShowModal In-Reply-To: References: <201008151457.54889.gambas@...1...> Message-ID: <201008151601.19831.gambas@...1...> > Yes, after I wrote my mail, I figured it may be the case. > Problem is that my program is oriented to module. > It invokes forms when needed and shows with them what > happens inside of module. Yes. Maybe that automatic main window feature should be optional... > > Project I'm working on is big, old and messy. It is ported from vb6. > Now I'm trying to make code more clear, but I'm getting signal 11. > I can't send this project to you, but I'm trying to isolate the problem. > Do gdb outputs help you without source code? > However, here: > > Program received signal SIGSEGV, Segmentation fault. > my_free (alloc=0x1e1d150a1e1d150a) at ../share/gb_alloc_temp.h:333 > 333 pool = (size / SIZE_INC) - 1; > (gdb) bt > #0 my_free (alloc=0x1e1d150a1e1d150a) at ../share/gb_alloc_temp.h:333 > #1 0x000000000042b6ef in EXTERN_exit () at gbx_extern.c:438 > #2 0x00000000004216ae in main_exit (silent=) at > gbx.c:135 #3 0x0000000000421e0f in main (argc=1, argv= out>) at gbx.c:391 > > Jussi > Yes, but not necessarily. If a bug corrupts memory, then the crash can occurs later, and then the backtrace is meaningless. The better is using valgrind and reproducing the crash. To do that, run your project that way: $ cd /path/to/my/project $ valgrind --tool=memcheck --num-callers=50 --track-origins=yes gbx3 ... Do what is needed to get a crash, and then send me the valgrind output. Sometimes, the program won't crash, because valgrind always tries to continue even after a segmentation fault. Send me the valgrind output anyway! Regards, -- Beno?t Minisini From jussi.lahtinen at ...626... Sun Aug 15 16:42:33 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Sun, 15 Aug 2010 17:42:33 +0300 Subject: [Gambas-user] Bug affecting to ShowModal In-Reply-To: <201008151601.19831.gambas@...1...> References: <201008151457.54889.gambas@...1...> <201008151601.19831.gambas@...1...> Message-ID: Because of messiness, that program could do anything weird (clarification is not ready yet). Problem occurs when program is closing. Here: ==4946== Memcheck, a memory error detector ==4946== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==4946== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info ==4946== Command: gbx3 ==4946== ==4946== Conditional jump or move depends on uninitialised value(s) ==4946== at 0x405178: my_free (gb_alloc_temp.h:324) ==4946== by 0x42B6EE: EXTERN_exit (gbx_extern.c:438) ==4946== by 0x4216AD: main_exit (gbx.c:135) ==4946== by 0x421E0E: main (gbx.c:391) ==4946== Uninitialised value was created by a heap allocation ==4946== at 0x4C284A8: malloc (vg_replace_malloc.c:236) ==4946== by 0x405295: my_malloc (gb_alloc_temp.h:308) ==4946== by 0x42B25C: get_function (gbx_extern.c:184) ==4946== by 0x42B7A3: EXTERN_call (gbx_extern.c:243) ==4946== by 0x42FA1F: EXEC_loop (gbx_exec_loop.c:1056) ==4946== by 0x409DB5: EXEC_function_loop (gbx_exec.c:858) ==4946== by 0x40A808: EXEC_function_real (gbx_exec.c:845) ==4946== by 0x41C20B: raise_event (gbx_api.c:483) ==4946== by 0x41C9E6: GB_Raise (gbx_api.c:583) ==4946== by 0x60C6024: CButton::clicked() (CButton.cpp:690) ==4946== by 0x60C5D09: CButton::qt_metacall(QMetaObject::Call, int, void**) (CButton_moc.cpp:173) ==4946== by 0x7E0CE3E: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.6.2) ==4946== by 0x784E5F1: QAbstractButton::clicked(bool) (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x756886A: ??? (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x756970A: ??? (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x756997B: QAbstractButton::mouseReleaseEvent(QMouseEvent*) (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x7209581: QWidget::event(QEvent*) (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x71B322B: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x71B9ECA: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x7DFA06B: QCoreApplication::notifyInternal(QObject*, QEvent*) (in /usr/lib/libQtCore.so.4.6.2) ==4946== by 0x71B90AD: QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer&, bool) (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x7238F64: ??? (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x72378AB: QApplication::x11ProcessEvent(_XEvent*) (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x7264198: ??? (in /usr/lib/libQtGui.so.4.6.2) ==4946== by 0x7DF8991: QEventLoop::processEvents(QFlags) (in /usr/lib/libQtCore.so.4.6.2) ==4946== by 0x7DF8D6B: QEventLoop::exec(QFlags) (in /usr/lib/libQtCore.so.4.6.2) ==4946== by 0x60C32DD: MyMainWindow::showModal() (CWindow.cpp:1790) ==4946== by 0x60C3353: CWINDOW_show_modal(void*, void*) (CWindow.cpp:698) ==4946== by 0x408C93: EXEC_native_quick (gbx_exec.c:1084) ==4946== by 0x42F808: EXEC_loop (gbx_exec_loop.c:970) ==4946== by 0x409DB5: EXEC_function_loop (gbx_exec.c:858) ==4946== by 0x40A808: EXEC_function_real (gbx_exec.c:845) ==4946== by 0x421D2D: main (gbx.c:359) ==4946== ==4946== ==4946== HEAP SUMMARY: ==4946== in use at exit: 6,599,259 bytes in 36,597 blocks ==4946== total heap usage: 317,322 allocs, 280,725 frees, 552,830,515 bytes allocated ==4946== ==4946== LEAK SUMMARY: ==4946== definitely lost: 15,304 bytes in 28 blocks ==4946== indirectly lost: 57,616 bytes in 1,797 blocks ==4946== possibly lost: 5,124,760 bytes in 27,867 blocks ==4946== still reachable: 1,371,899 bytes in 6,622 blocks ==4946== suppressed: 29,680 bytes in 283 blocks ==4946== Rerun with --leak-check=full to see details of leaked memory ==4946== ==4946== For counts of detected and suppressed errors, rerun with: -v ==4946== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 20 from 8) Jussi 2010/8/15 Beno?t Minisini : >> Yes, after I wrote my mail, I figured it may be the case. >> Problem is that my program is oriented to module. >> It invokes forms when needed and shows with them what >> happens inside of module. > > Yes. Maybe that automatic main window feature should be optional... > >> >> Project I'm working on is big, old and messy. It is ported from vb6. >> Now I'm trying to make code more clear, but I'm getting signal 11. >> I can't send this project to you, but I'm trying to isolate the problem. >> Do gdb outputs help you without source code? >> However, here: >> >> Program received signal SIGSEGV, Segmentation fault. >> my_free (alloc=0x1e1d150a1e1d150a) at ../share/gb_alloc_temp.h:333 >> 333 ? ? ? ? ? pool = (size / SIZE_INC) - 1; >> (gdb) bt >> #0 ?my_free (alloc=0x1e1d150a1e1d150a) at ../share/gb_alloc_temp.h:333 >> #1 ?0x000000000042b6ef in EXTERN_exit () at gbx_extern.c:438 >> #2 ?0x00000000004216ae in main_exit (silent=) at >> gbx.c:135 #3 ?0x0000000000421e0f in main (argc=1, argv=> out>) at gbx.c:391 >> >> Jussi >> > > Yes, but not necessarily. If a bug corrupts memory, then the crash can occurs > later, and then the backtrace is meaningless. > > The better is using valgrind and reproducing the crash. To do that, run your > project that way: > > $ cd /path/to/my/project > $ valgrind --tool=memcheck --num-callers=50 --track-origins=yes gbx3 > ... > > Do what is needed to get a crash, and then send me the valgrind output. > > Sometimes, the program won't crash, because valgrind always tries to continue > even after a segmentation fault. Send me the valgrind output anyway! > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From gambas at ...1... Sun Aug 15 16:47:43 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 15 Aug 2010 16:47:43 +0200 Subject: [Gambas-user] Bug affecting to ShowModal In-Reply-To: References: <201008151601.19831.gambas@...1...> Message-ID: <201008151647.43145.gambas@...1...> > Because of messiness, that program could do anything weird > (clarification is not ready yet). > Problem occurs when program is closing. > Here: > > ==4946== Memcheck, a memory error detector > ==4946== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. > ==4946== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for > copyright info > ==4946== Command: gbx3 > ==4946== > ==4946== Conditional jump or move depends on uninitialised value(s) > ==4946== at 0x405178: my_free (gb_alloc_temp.h:324) > ==4946== by 0x42B6EE: EXTERN_exit (gbx_extern.c:438) > ==4946== by 0x4216AD: main_exit (gbx.c:135) > ==4946== by 0x421E0E: main (gbx.c:391) > ==4946== Uninitialised value was created by a heap allocation > ==4946== at 0x4C284A8: malloc (vg_replace_malloc.c:236) > ==4946== by 0x405295: my_malloc (gb_alloc_temp.h:308) > ==4946== by 0x42B25C: get_function (gbx_extern.c:184) > ==4946== by 0x42B7A3: EXTERN_call (gbx_extern.c:243) > ==4946== by 0x42FA1F: EXEC_loop (gbx_exec_loop.c:1056) > ==4946== by 0x409DB5: EXEC_function_loop (gbx_exec.c:858) > ==4946== by 0x40A808: EXEC_function_real (gbx_exec.c:845) > ==4946== by 0x41C20B: raise_event (gbx_api.c:483) > ==4946== by 0x41C9E6: GB_Raise (gbx_api.c:583) > ==4946== by 0x60C6024: CButton::clicked() (CButton.cpp:690) > ==4946== by 0x60C5D09: CButton::qt_metacall(QMetaObject::Call, int, > void**) (CButton_moc.cpp:173) > ==4946== by 0x7E0CE3E: QMetaObject::activate(QObject*, QMetaObject > const*, int, void**) (in /usr/lib/libQtCore.so.4.6.2) > ==4946== by 0x784E5F1: QAbstractButton::clicked(bool) (in > /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x756886A: ??? (in /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x756970A: ??? (in /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x756997B: > QAbstractButton::mouseReleaseEvent(QMouseEvent*) (in > /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x7209581: QWidget::event(QEvent*) (in > /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x71B322B: QApplicationPrivate::notify_helper(QObject*, > QEvent*) (in /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x71B9ECA: QApplication::notify(QObject*, QEvent*) (in > /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x7DFA06B: QCoreApplication::notifyInternal(QObject*, > QEvent*) (in /usr/lib/libQtCore.so.4.6.2) > ==4946== by 0x71B90AD: > QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, > QWidget*, QWidget**, QPointer&, bool) (in > /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x7238F64: ??? (in /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x72378AB: QApplication::x11ProcessEvent(_XEvent*) (in > /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x7264198: ??? (in /usr/lib/libQtGui.so.4.6.2) > ==4946== by 0x7DF8991: > QEventLoop::processEvents(QFlags) (in > /usr/lib/libQtCore.so.4.6.2) > ==4946== by 0x7DF8D6B: > QEventLoop::exec(QFlags) (in > /usr/lib/libQtCore.so.4.6.2) > ==4946== by 0x60C32DD: MyMainWindow::showModal() (CWindow.cpp:1790) > ==4946== by 0x60C3353: CWINDOW_show_modal(void*, void*) > (CWindow.cpp:698) ==4946== by 0x408C93: EXEC_native_quick > (gbx_exec.c:1084) > ==4946== by 0x42F808: EXEC_loop (gbx_exec_loop.c:970) > ==4946== by 0x409DB5: EXEC_function_loop (gbx_exec.c:858) > ==4946== by 0x40A808: EXEC_function_real (gbx_exec.c:845) > ==4946== by 0x421D2D: main (gbx.c:359) > ==4946== > ==4946== > ==4946== HEAP SUMMARY: > ==4946== in use at exit: 6,599,259 bytes in 36,597 blocks > ==4946== total heap usage: 317,322 allocs, 280,725 frees, > 552,830,515 bytes allocated > ==4946== > ==4946== LEAK SUMMARY: > ==4946== definitely lost: 15,304 bytes in 28 blocks > ==4946== indirectly lost: 57,616 bytes in 1,797 blocks > ==4946== possibly lost: 5,124,760 bytes in 27,867 blocks > ==4946== still reachable: 1,371,899 bytes in 6,622 blocks > ==4946== suppressed: 29,680 bytes in 283 blocks > ==4946== Rerun with --leak-check=full to see details of leaked memory > ==4946== > ==4946== For counts of detected and suppressed errors, rerun with: -v > ==4946== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 20 from 8) > > Jussi > OK. The bug should be fixed in revision #3119. Regards, -- Beno?t Minisini From jussi.lahtinen at ...626... Sun Aug 15 18:44:28 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Sun, 15 Aug 2010 19:44:28 +0300 Subject: [Gambas-user] Bug affecting to ShowModal In-Reply-To: <201008151647.43145.gambas@...1...> References: <201008151601.19831.gambas@...1...> <201008151647.43145.gambas@...1...> Message-ID: Everything seems to work correctly now. Thanks! Jussi 2010/8/15 Beno?t Minisini : >> Because of messiness, that program could do anything weird >> (clarification is not ready yet). >> Problem occurs when program is closing. >> Here: >> >> ==4946== Memcheck, a memory error detector >> ==4946== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. >> ==4946== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for >> copyright info >> ==4946== Command: gbx3 >> ==4946== >> ==4946== Conditional jump or move depends on uninitialised value(s) >> ==4946== ? ?at 0x405178: my_free (gb_alloc_temp.h:324) >> ==4946== ? ?by 0x42B6EE: EXTERN_exit (gbx_extern.c:438) >> ==4946== ? ?by 0x4216AD: main_exit (gbx.c:135) >> ==4946== ? ?by 0x421E0E: main (gbx.c:391) >> ==4946== ?Uninitialised value was created by a heap allocation >> ==4946== ? ?at 0x4C284A8: malloc (vg_replace_malloc.c:236) >> ==4946== ? ?by 0x405295: my_malloc (gb_alloc_temp.h:308) >> ==4946== ? ?by 0x42B25C: get_function (gbx_extern.c:184) >> ==4946== ? ?by 0x42B7A3: EXTERN_call (gbx_extern.c:243) >> ==4946== ? ?by 0x42FA1F: EXEC_loop (gbx_exec_loop.c:1056) >> ==4946== ? ?by 0x409DB5: EXEC_function_loop (gbx_exec.c:858) >> ==4946== ? ?by 0x40A808: EXEC_function_real (gbx_exec.c:845) >> ==4946== ? ?by 0x41C20B: raise_event (gbx_api.c:483) >> ==4946== ? ?by 0x41C9E6: GB_Raise (gbx_api.c:583) >> ==4946== ? ?by 0x60C6024: CButton::clicked() (CButton.cpp:690) >> ==4946== ? ?by 0x60C5D09: CButton::qt_metacall(QMetaObject::Call, int, >> void**) (CButton_moc.cpp:173) >> ==4946== ? ?by 0x7E0CE3E: QMetaObject::activate(QObject*, QMetaObject >> const*, int, void**) (in /usr/lib/libQtCore.so.4.6.2) >> ==4946== ? ?by 0x784E5F1: QAbstractButton::clicked(bool) (in >> /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x756886A: ??? (in /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x756970A: ??? (in /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x756997B: >> QAbstractButton::mouseReleaseEvent(QMouseEvent*) (in >> /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x7209581: QWidget::event(QEvent*) (in >> /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x71B322B: QApplicationPrivate::notify_helper(QObject*, >> QEvent*) (in /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x71B9ECA: QApplication::notify(QObject*, QEvent*) (in >> /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x7DFA06B: QCoreApplication::notifyInternal(QObject*, >> QEvent*) (in /usr/lib/libQtCore.so.4.6.2) >> ==4946== ? ?by 0x71B90AD: >> QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, >> QWidget*, QWidget**, QPointer&, bool) (in >> /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x7238F64: ??? (in /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x72378AB: QApplication::x11ProcessEvent(_XEvent*) (in >> /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x7264198: ??? (in /usr/lib/libQtGui.so.4.6.2) >> ==4946== ? ?by 0x7DF8991: >> QEventLoop::processEvents(QFlags) (in >> /usr/lib/libQtCore.so.4.6.2) >> ==4946== ? ?by 0x7DF8D6B: >> QEventLoop::exec(QFlags) (in >> /usr/lib/libQtCore.so.4.6.2) >> ==4946== ? ?by 0x60C32DD: MyMainWindow::showModal() (CWindow.cpp:1790) >> ==4946== ? ?by 0x60C3353: CWINDOW_show_modal(void*, void*) >> (CWindow.cpp:698) ==4946== ? ?by 0x408C93: EXEC_native_quick >> (gbx_exec.c:1084) >> ==4946== ? ?by 0x42F808: EXEC_loop (gbx_exec_loop.c:970) >> ==4946== ? ?by 0x409DB5: EXEC_function_loop (gbx_exec.c:858) >> ==4946== ? ?by 0x40A808: EXEC_function_real (gbx_exec.c:845) >> ==4946== ? ?by 0x421D2D: main (gbx.c:359) >> ==4946== >> ==4946== >> ==4946== HEAP SUMMARY: >> ==4946== ? ? in use at exit: 6,599,259 bytes in 36,597 blocks >> ==4946== ? total heap usage: 317,322 allocs, 280,725 frees, >> 552,830,515 bytes allocated >> ==4946== >> ==4946== LEAK SUMMARY: >> ==4946== ? ?definitely lost: 15,304 bytes in 28 blocks >> ==4946== ? ?indirectly lost: 57,616 bytes in 1,797 blocks >> ==4946== ? ? ?possibly lost: 5,124,760 bytes in 27,867 blocks >> ==4946== ? ?still reachable: 1,371,899 bytes in 6,622 blocks >> ==4946== ? ? ? ? suppressed: 29,680 bytes in 283 blocks >> ==4946== Rerun with --leak-check=full to see details of leaked memory >> ==4946== >> ==4946== For counts of detected and suppressed errors, rerun with: -v >> ==4946== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 20 from 8) >> >> Jussi >> > > OK. The bug should be fixed in revision #3119. > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From demosthenesk at ...626... Sun Aug 15 20:51:38 2010 From: demosthenesk at ...626... (Demosthenes Koptsis) Date: Sun, 15 Aug 2010 21:51:38 +0300 Subject: [Gambas-user] SHELL is more faster than SUB Process_Read() Message-ID: Hi i wrote a test program that "ls -1" a directory with 1700 and more files (mp3). i wanted to make a string as following Content = "/mnt/store/MUSIC/free/new age/webradio recs/Trancemission.FM Radio 128K- New Age 2- new experience of meditation and new age music - livestream 128k/" & sLine in order to list with full path the files. but i dont get the wanted result. The SHELL command runs faster than Process_Read. This mess up the result of concatenation. The code is the following: -------------------------------------------------------------------------------- ' Gambas class file PUBLIC SUB Button1_Click() SHELL "ls -1 \'/mnt/store/MUSIC/free/new age/webradio recs/Trancemission.FM Radio 128K- New Age 2- new experience of meditation and new age music - livestream 128k/\'" FOR READ END PUBLIC SUB Process_Read() DIM sLine AS String DIM Content AS String ' IF Eof(LAST) THEN RETURN READ #LAST, sLine Content = "/mnt/store/MUSIC/free/new age/webradio recs/Trancemission.FM Radio 128K- New Age 2- new experience of meditation and new age music - livestream 128k/" & sLine PRINT Content; CATCH Message("Error code " & Error.Code & " Error message " & Error.Text) END -------------------------------------------------------------------------------- Also i get EOF but the PRINT still runs in background. Is this behavior normal? -- ???? ???? ?? ?????!!! Regards, Demosthenes Koptsis From garulfounix at ...626... Sun Aug 15 20:57:30 2010 From: garulfounix at ...626... (=?utf-8?q?Fran=C3=A7ois?=) Date: Sun, 15 Aug 2010 20:57:30 +0200 Subject: [Gambas-user] Error in example MoviePlayer in Gambas 3 In-Reply-To: <201008151302.26362.gambas@...1...> References: <1281838386.5147.2.camel@...2406...> <201008151302.26362.gambas@...1...> Message-ID: <201008152057.31149.garulfounix@...626...> Le dimanche 15 ao?t 2010 13:02:26, Beno?t Minisini a ?crit : > > Hi. > > > > When I try to run the sample MoviePlayer, gives me this error: > > > > Wid = 4400040 > > > > (MoviePlayer:5144): Gtk-CRITICAL **: gtk_widget_set_events: assertion `! > > GTK_WIDGET_REALIZED (widget)' failed > > > > This error occurs by GNOME canvas control? > > > > Regards > > Fixed in revision #3116. > > Regards, For me when i try to run a movie with the sample MoviePlayer, the program is freezing. Are there any no format that From gambas at ...1... Sun Aug 15 21:01:42 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 15 Aug 2010 21:01:42 +0200 Subject: [Gambas-user] Error in example MoviePlayer in Gambas 3 In-Reply-To: <201008152057.31149.garulfounix@...626...> References: <1281838386.5147.2.camel@...2406...> <201008151302.26362.gambas@...1...> <201008152057.31149.garulfounix@...626...> Message-ID: <201008152101.42850.gambas@...1...> > Le dimanche 15 ao?t 2010 13:02:26, Beno?t Minisini a ?crit : > > > Hi. > > > > > > When I try to run the sample MoviePlayer, gives me this error: > > > > > > Wid = 4400040 > > > > > > (MoviePlayer:5144): Gtk-CRITICAL **: gtk_widget_set_events: assertion > > > `! GTK_WIDGET_REALIZED (widget)' failed > > > > > > This error occurs by GNOME canvas control? > > > > > > Regards > > > > Fixed in revision #3116. > > > > Regards, > > For me when i try to run a movie with the sample MoviePlayer, the program > is freezing. > Are there any no format that > Did you try the revision #3116 or are you using something older ? -- Beno?t Minisini From gambas.fr at ...626... Sun Aug 15 21:32:58 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Sun, 15 Aug 2010 21:32:58 +0200 Subject: [Gambas-user] SHELL is more faster than SUB Process_Read() In-Reply-To: References: Message-ID: 2010/8/15 Demosthenes Koptsis : > Hi i wrote a test program that "ls -1" a directory with 1700 and more files > (mp3). > > i wanted to make a string as following > > ?Content = "/mnt/store/MUSIC/free/new age/webradio recs/Trancemission.FM > Radio 128K- New Age 2- new experience of meditation and new age music - > livestream 128k/" & sLine > > in order to list with full path the files. > > but i dont get the wanted result. > > > The SHELL command runs faster than Process_Read. > > This mess up the result of concatenation. > > The code is the following: > > -------------------------------------------------------------------------------- > ' Gambas class file > > PUBLIC SUB Button1_Click() > ?SHELL "ls -1 \'/mnt/store/MUSIC/free/new age/webradio > recs/Trancemission.FM Radio 128K- New Age 2- new experience of meditation > and new age music - livestream 128k/\'" FOR READ > > END > > PUBLIC SUB Process_Read() > > ?DIM sLine AS String > ?DIM Content AS String > > ' ?IF Eof(LAST) THEN RETURN > > ?READ #LAST, sLine > > ?Content = "/mnt/store/MUSIC/free/new age/webradio recs/Trancemission.FM > Radio 128K- New Age 2- new experience of meditation and new age music - > livestream 128k/" & sLine > ?PRINT Content; > > > CATCH > Message("Error code " & Error.Code & " Error message " & Error.Text) > > END > > -------------------------------------------------------------------------------- > > Also i get EOF but the PRINT still runs in background. > > Is this behavior normal? > yes in the ide ... try this program in a console without the ide ... for that generate an executable... that's because the ide and qt make a buffer of not already showed entries and the editor that is used to show the entry is a bit slower From soleilpqd at ...626... Sun Aug 15 22:09:46 2010 From: soleilpqd at ...626... (=?UTF-8?B?UGjhuqFtIFF1YW5nIETGsMahbmc=?=) Date: Mon, 16 Aug 2010 03:09:46 +0700 Subject: [Gambas-user] EXEC or SHELL can not READ WRITE simultaneously well with process? Message-ID: I have searched around with Google but still can not find an other problem like mine. My code below base on the Console example project of Gambas. I want run a process like this: PUBLIC $mainProcess AS Process PUBLIC SUB Form_Open() $mainProcess = SHELL "7z x /demo/file.7z -o/tmp" FOR READ WRITE ' Extract /demo/file.7z to /tmp folder, same problem with EXEC END Note that I have extracted this file to /tmp before, so 7z will ask overwrite or not. And I want take control and answer from Gambas: PUBLIC SUB Process_Read() DIM sLine AS String LINE INPUT #$mainProcess, sLine ' I used READ #$mainProcess, sLine, -256 too, but it break some line, and read multiple line in same moment txtLog.Text &= sLine & gb.newline IF InStr(sLine, "(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit?") > 0 THEN ' A message.question here, then print an answer like this PRINT #$mainProcess, "Q" ' Quit the process ENDIF END Also I created a button to manually response to process: PRIVATE SUB Button1_Click() PRINT #$mainProcess, "Q" END Finally, to detect program working: PUBLIC SUB Process_Kill() Message.Info("Process terminated") END My problem is, if I use FOR READ WRITE, I can't get the process output until process terminates (SUB Process_Read() seems not work - txtLog is blank). When I click the Button1, the process terminates immediately, and now the output appears in txtLog text box. If I use FOR INPUT OUTPUT, I can get the output like I want - the output appears in txtLog text box, (SUB Process_Read() work => PRINT "Quit" message to process) but process not terminates, even when I click Button1. An other small problem is from Gambas IDE. I use shortcut keys (Ctrl+C, Ctrl+X) to copy, cut text from Gambas Editor (when cut, the selected text disappears), but I can not paste anywhere, even back to Gambas editor. But I use the context menu, it works fine. My Gambas version is 2.20 (full is 2.20.2-1.fc13.i686) on Fedora 13. My machiine is DELL Inspiron 1440 (Pen Dual Core). Thank for answers. Sorry for my English. From gambas at ...1... Sun Aug 15 22:18:52 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 15 Aug 2010 22:18:52 +0200 Subject: [Gambas-user] EXEC or SHELL can not READ WRITE simultaneously well with process? In-Reply-To: References: Message-ID: <201008152218.52770.gambas@...1...> > I have searched around with Google but still can not find an other problem > like mine. > My code below base on the Console example project of Gambas. > I want run a process like this: > > PUBLIC $mainProcess AS Process > > PUBLIC SUB Form_Open() > > $mainProcess = SHELL "7z x /demo/file.7z -o/tmp" FOR READ WRITE ' > Extract /demo/file.7z to /tmp folder, same problem with EXEC > > END > > Note that I have extracted this file to /tmp before, so 7z will ask > overwrite or not. And I want take control and answer from Gambas: > > PUBLIC SUB Process_Read() > > DIM sLine AS String > > LINE INPUT #$mainProcess, sLine ' I used READ #$mainProcess, sLine, -256 > too, but it break some line, and read multiple line in same moment > txtLog.Text &= sLine & gb.newline > IF InStr(sLine, "(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all > / (Q)uit?") > 0 THEN > ' A message.question here, then print an answer like this > PRINT #$mainProcess, "Q" ' Quit the process > ENDIF > > END > > Also I created a button to manually response to process: > > PRIVATE SUB Button1_Click() > > PRINT #$mainProcess, "Q" > > END > > Finally, to detect program working: > > PUBLIC SUB Process_Kill() > > Message.Info("Process terminated") > > END > > My problem is, if I use FOR READ WRITE, I can't get the process output > until process terminates (SUB Process_Read() seems not work - txtLog is > blank). When I click the Button1, the process terminates immediately, and > now the output appears in txtLog text box. > If I use FOR INPUT OUTPUT, I can get the output like I want - the output > appears in txtLog text box, (SUB Process_Read() work => PRINT "Quit" > message to process) but process not terminates, even when I click Button1. > You must not use 'LINE INPUT #Process, Var' to read a process output in Process_Read. You must use 'READ #Process, Var, -MaxLength', add 'Var' to a 'Buffer', and extract lines from that 'Buffer'. Without a full project to test, I cannot say more at the moment. Note that Gambas 3 is more clever than Gambas 2 for that kind of situation. > An other small problem is from Gambas IDE. I use shortcut keys (Ctrl+C, > Ctrl+X) to copy, cut text from Gambas Editor (when cut, the selected text > disappears), but I can not paste anywhere, even back to Gambas editor. But > I use the context menu, it works fine. CTRL+V works perfectly there. Do you have more details? -- Beno?t Minisini From gambas at ...1... Sun Aug 15 22:24:56 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 15 Aug 2010 22:24:56 +0200 Subject: [Gambas-user] SHELL is more faster than SUB Process_Read() In-Reply-To: References: Message-ID: <201008152224.56383.gambas@...1...> > Hi i wrote a test program that "ls -1" a directory with 1700 and more files > (mp3). > > i wanted to make a string as following > > Content = "/mnt/store/MUSIC/free/new age/webradio recs/Trancemission.FM > Radio 128K- New Age 2- new experience of meditation and new age music - > livestream 128k/" & sLine > > in order to list with full path the files. > > but i dont get the wanted result. > > > The SHELL command runs faster than Process_Read. > > This mess up the result of concatenation. > > The code is the following: > > --------------------------------------------------------------------------- > ----- ' Gambas class file > > PUBLIC SUB Button1_Click() > SHELL "ls -1 \'/mnt/store/MUSIC/free/new age/webradio > recs/Trancemission.FM Radio 128K- New Age 2- new experience of meditation > and new age music - livestream 128k/\'" FOR READ > > END > > PUBLIC SUB Process_Read() > > DIM sLine AS String > DIM Content AS String > > ' IF Eof(LAST) THEN RETURN > > READ #LAST, sLine That line is not correct, because you are reading the string from the stream in the internal Gambas format (length stored in one, two or four bytes, followed by the string contents), whereas the process just send characters on its standard output. See the documentation on READ for more details. You must do that to read the standard output of a process: PRIVATE $sBuffer AS String PUBLIC SUB Process_Read() READ #LAST, sData, Lof(#LAST) $sBuffer &= sData DO iPos = Instr($sBuffer, "\n") IF iPos = 0 THEN BREAK sLine = Left($sBuffer, iPos - 1) $sBuffer = Mid$($sBuffer, iPos + 1) ' Do what you need with sLine LOOP END Regards, -- Beno?t Minisini From demosthenesk at ...626... Mon Aug 16 07:52:52 2010 From: demosthenesk at ...626... (Demosthenes Koptsis) Date: Mon, 16 Aug 2010 08:52:52 +0300 Subject: [Gambas-user] SHELL is more faster than SUB Process_Read() In-Reply-To: <201008152224.56383.gambas@...1...> References: <201008152224.56383.gambas@...1...> Message-ID: ok , i got it. Thanks both of u! 2010/8/15 Beno?t Minisini > > Hi i wrote a test program that "ls -1" a directory with 1700 and more > files > > (mp3). > > > > i wanted to make a string as following > > > > Content = "/mnt/store/MUSIC/free/new age/webradio recs/Trancemission.FM > > Radio 128K- New Age 2- new experience of meditation and new age music - > > livestream 128k/" & sLine > > > > in order to list with full path the files. > > > > but i dont get the wanted result. > > > > > > The SHELL command runs faster than Process_Read. > > > > This mess up the result of concatenation. > > > > The code is the following: > > > > > --------------------------------------------------------------------------- > > ----- ' Gambas class file > > > > PUBLIC SUB Button1_Click() > > SHELL "ls -1 \'/mnt/store/MUSIC/free/new age/webradio > > recs/Trancemission.FM Radio 128K- New Age 2- new experience of meditation > > and new age music - livestream 128k/\'" FOR READ > > > > END > > > > PUBLIC SUB Process_Read() > > > > DIM sLine AS String > > DIM Content AS String > > > > ' IF Eof(LAST) THEN RETURN > > > > READ #LAST, sLine > > That line is not correct, because you are reading the string from the > stream > in the internal Gambas format (length stored in one, two or four bytes, > followed by the string contents), whereas the process just send characters > on > its standard output. See the documentation on READ for more details. > > You must do that to read the standard output of a process: > > PRIVATE $sBuffer AS String > > PUBLIC SUB Process_Read() > > READ #LAST, sData, Lof(#LAST) > $sBuffer &= sData > > DO > iPos = Instr($sBuffer, "\n") > IF iPos = 0 THEN BREAK > sLine = Left($sBuffer, iPos - 1) > $sBuffer = Mid$($sBuffer, iPos + 1) > > ' Do what you need with sLine > > LOOP > > END > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > -- ???? ???? ?? ?????!!! Regards, Demosthenes Koptsis From gambas at ...1... Mon Aug 16 16:38:12 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 16 Aug 2010 16:38:12 +0200 Subject: [Gambas-user] Pretty printer Message-ID: <201008161638.12672.gambas@...1...> Hi, Just before leaving Paris (and my computer) for a week, I have added a pretty printer in the IDE code editor. Run it by clicking on the magic wand button in the toolbar. It is a bit rudimentary, but I think it will make all the randomly indented code I often receive more readable for me. :-) And if you have suggestions about what kind of options that pretty printer may have, tell me. That way, I will be able to make it automatic. Regards, -- Beno?t Minisini From prog at ...2177... Mon Aug 16 17:43:42 2010 From: prog at ...2177... (craf) Date: Mon, 16 Aug 2010 11:43:42 -0400 Subject: [Gambas-user] Pretty printer In-Reply-To: <201008161638.12672.gambas@...1...> References: <201008161638.12672.gambas@...1...> Message-ID: <1281973422.24563.0.camel@...2406...> -----Mensaje original----- >De: Beno?t Minisini >Reply-to: mailing list for gambas users > >Para: gambas-user at lists.sourceforge.net >Asunto: [Gambas-user] Pretty printer >Fecha: Mon, 16 Aug 2010 16:38:12 +0200 >Hi, >Just before leaving Paris (and my computer) for a week, I have added a pretty >printer in the IDE code editor. >Run it by clicking on the magic wand button in the toolbar. >It is a bit rudimentary, but I think it will make all the randomly indented >code I often receive more readable for me. :-) >And if you have suggestions about what kind of options that pretty printer may >have, tell me. That way, I will be able to make it automatic. >Regards, From prog at ...2177... Mon Aug 16 17:45:02 2010 From: prog at ...2177... (craf) Date: Mon, 16 Aug 2010 11:45:02 -0400 Subject: [Gambas-user] Pretty printer In-Reply-To: <201008161638.12672.gambas@...1...> References: <201008161638.12672.gambas@...1...> Message-ID: <1281973502.24563.1.camel@...2406...> >-----Mensaje original----- >De: Beno?t Minisini >Reply-to: mailing list for gambas users > >Para: gambas-user at lists.sourceforge.net >Asunto: [Gambas-user] Pretty printer >Fecha: Mon, 16 Aug 2010 16:38:12 +0200 >Hi, >Just before leaving Paris (and my computer) for a week, I have added a pretty >printer in the IDE code editor. >Run it by clicking on the magic wand button in the toolbar. >It is a bit rudimentary, but I think it will make all the randomly indented >code I often receive more readable for me. :-) >And if you have suggestions about what kind of options that pretty printer may >have, tell me. That way, I will be able to make it automatic. >Regards, Fantastic!, really useful. Regards From dag.jarle.johansen at ...2312... Mon Aug 16 18:50:01 2010 From: dag.jarle.johansen at ...2312... (Dag Jarle Johansen) Date: Mon, 16 Aug 2010 13:50:01 -0300 Subject: [Gambas-user] SVN and Distribution In-Reply-To: <201008151200.54593.gambas@...1...> References: <201008151200.54593.gambas@...1...> Message-ID: Am Sonntag, den 15.08.2010, 12:00 +0200 schrieb Beno?t Minisini: > > Hi all. > > > > I will have to distribute a little programm, so I will have to install > > Gambas 2.x too, I asume. My question is: Will there be any conflicts > > between the SVN for Gambas 3.x rev. 3098 and a new installation of 2.x? > > I will mainly dewvelop with the SVN, so I'd rather seek another solution > > than to mess up a working environment. > > > > Thanks and regards, > > Dag-Jarle Johansen > > > > > > Gambas 2 and Gambas 3 are installed in their own directory, and the files > installed in common directories (like /usr/bin or /usr/local/bin) are named > differently. > > So you can have them both on your machine. How could I do otherwise? :-) > Thank you, Benoit, sure you couldn't otherwise. I just want to make sure not to mess up anything, that is pretty easy sometimes. :) Regards, Dag-Jarle Johansen From garulfounix at ...626... Tue Aug 17 15:18:18 2010 From: garulfounix at ...626... (=?utf-8?q?Fran=C3=A7ois?=) Date: Tue, 17 Aug 2010 15:18:18 +0200 Subject: [Gambas-user] Error in example MoviePlayer in Gambas 3 In-Reply-To: <201008152101.42850.gambas@...1...> References: <1281838386.5147.2.camel@...2406...> <201008152057.31149.garulfounix@...626...> <201008152101.42850.gambas@...1...> Message-ID: <201008171518.18624.garulfounix@...626...> Le dimanche 15 ao?t 2010 21:01:42, Beno?t Minisini a ?crit : > > Le dimanche 15 ao?t 2010 13:02:26, Beno?t Minisini a ?crit : > > > > Hi. > > > > > > > > When I try to run the sample MoviePlayer, gives me this error: > > > > > > > > Wid = 4400040 > > > > > > > > (MoviePlayer:5144): Gtk-CRITICAL **: gtk_widget_set_events: assertion > > > > `! GTK_WIDGET_REALIZED (widget)' failed > > > > > > > > This error occurs by GNOME canvas control? > > > > > > > > Regards > > > > > > Fixed in revision #3116. > > > > > > Regards, > > > > For me when i try to run a movie with the sample MoviePlayer, the program > > is freezing. > > Are there any no format that > > Did you try the revision #3116 or are you using something older ? I did a svn up and i had tried a revision version less than #3116. I use the last revision and now it works :) . From soleilpqd at ...626... Tue Aug 17 20:58:59 2010 From: soleilpqd at ...626... (=?UTF-8?B?UGjhuqFtIFF1YW5nIETGsMahbmc=?=) Date: Wed, 18 Aug 2010 01:58:59 +0700 Subject: [Gambas-user] EXEC or SHELL can not READ WRITE simultaneously well with process? In-Reply-To: <201008152218.52770.gambas@...1...> References: <201008152218.52770.gambas@...1...> Message-ID: 1. Thank you for your response, it works better now. 2.The problem of shortcuts keys Ctrl+C, Ctrl+X is: when I use those shortcut keys, I can paste only to the Gambas project editor window from where I copy (I can paste to different tabs). When I switch to other windows e.g gedit or an other Gambas project window, there's nothing to paste. But when return to the first Gambas project window, I still can paste. It's like that the shortcut keys use a "local clipboard" not the clipboard of system. But this problem doesn't happen with the context menu. (Paste here include both Ctrl+V and menu). From jussi.lahtinen at ...626... Tue Aug 17 21:28:52 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Tue, 17 Aug 2010 22:28:52 +0300 Subject: [Gambas-user] Bug in TrayIcon Message-ID: Hi! TrayIcon seems to work perfectly, until program that uses it, is started at startup of OS. Program is started with following command; gbr2 /home/MyName/ProgramsName.gambas Program has following code: PUBLIC Kuvake AS NEW TrayIcon AS "TrayIkoni" PUBLIC SUB Form_Open() Kuvake.Picture = Picture.Load("ikoni.png") Kuvake.Show() .... Following problems: With GTK+, trayicon never appears, everything else works fine. With Qt, error message at startup: " This application has raised an unexpected error and must abort. Embedding has failed. FMain.?.0 " Gambas 2.21 revision 3124 @ Ubuntu 10.04 64bit Jussi From fabianfloresvadell at ...626... Wed Aug 18 02:18:33 2010 From: fabianfloresvadell at ...626... (=?ISO-8859-1?Q?Fabi=E1n_Flores_Vadell?=) Date: Tue, 17 Aug 2010 21:18:33 -0300 Subject: [Gambas-user] error when using a custom control Message-ID: Hi everybody. I wrote a custom control using Gambas 2.21, is not finished yet but I need test packaging and installation. I installed it on two virtualized tests machines (ubuntu and kubuntu 10.04 by virtualbox). I installed Gambas 2.18 too, from repositories. When I add the control to a test proyect, the below error message is displayed: "UserControl class is missing in 'yourclass' component exported classes" "yourclass" is the name of my custom control. I understand that if a custom class inherits from another custom class, both must be exported. But how I could to export "UserControl"? -- Fabi?n Flores Vadell www.speedbooksargentina.blogspot.com From gambas.fr at ...626... Wed Aug 18 07:54:08 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Wed, 18 Aug 2010 07:54:08 +0200 Subject: [Gambas-user] error when using a custom control In-Reply-To: References: Message-ID: 2010/8/18 Fabi?n Flores Vadell : > Hi everybody. > > I wrote a custom control using Gambas 2.21, is not finished yet but I > need test packaging and installation. > > I installed it on two virtualized tests machines (ubuntu and kubuntu > 10.04 by virtualbox). I installed Gambas 2.18 too, from repositories. > > When I add the control to a test proyect, the below error message is displayed: > > "UserControl class is missing in 'yourclass' component exported classes" > > "yourclass" is the name of my custom control. > > I understand that if a custom class inherits from another custom > class, both must be exported. But how I could to export "UserControl"? usercontrol is provided by gb.qt or gb.gtk ... you need to indicate in yourcomponant what it need ! ... take a look in the project properties dialog > > -- > Fabi?n Flores Vadell > www.speedbooksargentina.blogspot.com > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From Karl.Reinl at ...2345... Wed Aug 18 17:50:34 2010 From: Karl.Reinl at ...2345... (Charlie Reinl) Date: Wed, 18 Aug 2010 17:50:34 +0200 Subject: [Gambas-user] error when using a custom control In-Reply-To: References: Message-ID: <1282146634.6561.10.camel@...40...> Am Dienstag, den 17.08.2010, 21:18 -0300 schrieb Fabi?n Flores Vadell: > Hi everybody. > > I wrote a custom control using Gambas 2.21, is not finished yet but I > need test packaging and installation. > > I installed it on two virtualized tests machines (ubuntu and kubuntu > 10.04 by virtualbox). I installed Gambas 2.18 too, from repositories. > > When I add the control to a test proyect, the below error message is displayed: > > "UserControl class is missing in 'yourclass' component exported classes" > > "yourclass" is the name of my custom control. > > I understand that if a custom class inherits from another custom > class, both must be exported. But how I could to export "UserControl"? > Salut, tell me if I'm wrong. I understand you like this. You made a gambas2.component and when you use it the first time you get that message. Right ? For gambas2.components I know that they after compiling chosen in there own project components list. You can see it while loading the project into the IDE on a box where it hadn't be used before.The component is claimed missing. Just press continue. -- Amicalement Charlie From admhardsoft at ...253... Wed Aug 18 18:00:46 2010 From: admhardsoft at ...253... (admhardsoft at ...253...) Date: Wed, 18 Aug 2010 16:00:46 +0000 Subject: [Gambas-user] Gambas forZ Message-ID: <300374295-1282147247-cardhu_decombobulator_blackberry.rim.net-1339945364-@...2470...> Sent on the TELUS Mobility network with BlackBerry From gambas.fr at ...626... Wed Aug 18 19:17:27 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Wed, 18 Aug 2010 19:17:27 +0200 Subject: [Gambas-user] error when using a custom control In-Reply-To: <1282146634.6561.10.camel@...40...> References: <1282146634.6561.10.camel@...40...> Message-ID: 2010/8/18 Charlie Reinl : > Am Dienstag, den 17.08.2010, 21:18 -0300 schrieb Fabi?n Flores Vadell: >> Hi everybody. >> >> I wrote a custom control using Gambas 2.21, is not finished yet but I >> need test packaging and installation. >> >> I installed it on two virtualized tests machines (ubuntu and kubuntu >> 10.04 by virtualbox). I installed Gambas 2.18 too, from repositories. >> >> When I add the control to a test proyect, the below error message is displayed: >> >> "UserControl class is missing in 'yourclass' component exported classes" >> >> "yourclass" is the name of my custom control. >> >> I understand that if a custom class inherits from another custom >> class, both must be exported. But how I could to export "UserControl"? >> > > Salut, > > tell me if I'm wrong. I understand you like this. > > You made a gambas2.component and when you use it the first time you get > that message. Right ? > > For gambas2.components I know that they after compiling chosen in there > own project components list. > > You can see it while loading the project into the IDE on a box where it > hadn't be used before.The component is claimed missing. > > Just press continue. > -- > Amicalement > Charlie > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > i think you have true charlie ... it's surely a missing component From fabianfloresvadell at ...626... Wed Aug 18 19:24:11 2010 From: fabianfloresvadell at ...626... (=?ISO-8859-1?Q?Fabi=E1n_Flores_Vadell?=) Date: Wed, 18 Aug 2010 14:24:11 -0300 Subject: [Gambas-user] error when using a custom control In-Reply-To: References: Message-ID: 2010/8/18 Fabien Bodard : > usercontrol is provided by gb.qt or gb.gtk ... you need to indicate in > yourcomponant what it need ! ... take a look in the project properties > dialog Thanks, Fabien. I forgot configure the tab "Requires" in the properties dialog. (But the error message led me in the wrong way). -- Fabi?n Flores Vadell www.speedbooksargentina.blogspot.com From kevinfishburne at ...1887... Wed Aug 18 23:22:37 2010 From: kevinfishburne at ...1887... (kevinfishburne) Date: Wed, 18 Aug 2010 14:22:37 -0700 (PDT) Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <201008122114.43582.gambas@...1...> References: <29413575.post@...1379...> <201008120035.28033.gambas@...1...> <29413824.post@...1379...> <201008120134.21698.gambas@...1...> <29414425.post@...1379...> <201008122114.43582.gambas@...1...> Message-ID: <29476167.post@...1379...> Beno?t Minisini wrote: > > I made an Image.DrawAlpha() method for you in revision #3101. Tell me if > this > is was you need. > I couldn't find it in GAMBAS 2 so I built GAMBAS 3. It had the new method, however I was unable to test it because Image.Draw() seemed not to work. Here's the project, so please let me know if something changed in GAMBAS 3 that caused this code to no longer work: http://old.nabble.com/file/p29476167/gb.image_drawalpha.tar.bz2 gb.image_drawalpha.tar.bz2 Also, does GAMBAS 3 have different dev dependencies than GAMBAS 2 for compiling? I successfully compile GAMBAS 2 all the time, but this was my first time compiling GAMBAS 3. ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:sales at ...1887... sales at ...1887... phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-image-alpha-channel-accessibility-tp29413575p29476167.html Sent from the gambas-user mailing list archive at Nabble.com. From nando_f at ...951... Wed Aug 18 23:24:32 2010 From: nando_f at ...951... (nando) Date: Wed, 18 Aug 2010 17:24:32 -0400 Subject: [Gambas-user] IDE editor (small) bug? Gambas 2.9 Message-ID: <20100818211749.M19625@...951...> Example: IF X < 1 OR X > 100 THEN 'My comment here Highlight any part of the line then press the TAB key. Tabs are inserted at the beginning of the line. -Fernando From admhardsoft at ...253... Thu Aug 19 08:41:12 2010 From: admhardsoft at ...253... (Tomas Rodriguez) Date: Thu, 19 Aug 2010 02:41:12 -0400 Subject: [Gambas-user] gambas for iphone or ipad apps Message-ID: Hi I would like to know How can I developer apps for ipod or iphone with gambas? somebody can tell me that? thanks tomas From gambas.fr at ...626... Thu Aug 19 09:19:51 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Thu, 19 Aug 2010 09:19:51 +0200 Subject: [Gambas-user] IDE editor (small) bug? Gambas 2.9 In-Reply-To: <20100818211749.M19625@...951...> References: <20100818211749.M19625@...951...> Message-ID: 2010/8/18 nando : > Example: > > IF X < 1 OR X > 100 THEN ? ? ? ? ? ? ? ? 'My comment here > > Highlight any part of the line then press the TAB key. > Tabs are inserted at the beginning of the line. > > -Fernando > this is not a bug but a feature... when a part of a line is selected the tab is added in the beginning of the line, and shift+tab remove it (2 spaces in fact) this feature is to help in code indentation > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From gambas.fr at ...626... Thu Aug 19 09:21:52 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Thu, 19 Aug 2010 09:21:52 +0200 Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <29476167.post@...1379...> References: <29413575.post@...1379...> <201008120035.28033.gambas@...1...> <29413824.post@...1379...> <201008120134.21698.gambas@...1...> <29414425.post@...1379...> <201008122114.43582.gambas@...1...> <29476167.post@...1379...> Message-ID: 2010/8/18 kevinfishburne : > > > Beno?t Minisini wrote: >> >> I made an Image.DrawAlpha() method for you in revision #3101. Tell me if >> this >> is was you need. >> > > I couldn't find it in GAMBAS 2 so I built GAMBAS 3. It had the new method, > however I was unable to test it because Image.Draw() seemed not to work. > Here's the project, so please let me know if something changed in GAMBAS 3 > that caused this code to no longer work: humm > > http://old.nabble.com/file/p29476167/gb.image_drawalpha.tar.bz2 > gb.image_drawalpha.tar.bz2 > > Also, does GAMBAS 3 have different dev dependencies than GAMBAS 2 for > compiling? I successfully compile GAMBAS 2 all the time, but this was my > first time compiling GAMBAS 3. yes, take a look here : http://gambasdoc.org/help/install > > > ----- > Kevin Fishburne, Eight Virtues > www: ?http://sales.eightvirtues.com http://sales.eightvirtues.com > e-mail: ?mailto:sales at ...1887... sales at ...1887... > phone: (770) 853-6271 > -- > View this message in context: http://old.nabble.com/gb.image%3A-image-alpha-channel-accessibility-tp29413575p29476167.html > Sent from the gambas-user mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From soleilpqd at ...626... Thu Aug 19 12:55:42 2010 From: soleilpqd at ...626... (=?UTF-8?B?UGjhuqFtIFF1YW5nIETGsMahbmc=?=) Date: Thu, 19 Aug 2010 17:55:42 +0700 Subject: [Gambas-user] gambas for iphone or ipad apps In-Reply-To: References: Message-ID: As I know, there's no way to do that. The only way to develop app for Iphone ( and this app can run on device / sell on store ) is use xcode IDE running on Mac. From admhardsoft at ...253... Thu Aug 19 15:35:09 2010 From: admhardsoft at ...253... (admhardsoft at ...253...) Date: Thu, 19 Aug 2010 13:35:09 +0000 Subject: [Gambas-user] gambas for iphone or ipad apps In-Reply-To: References: Message-ID: <587480250-1282224911-cardhu_decombobulator_blackberry.rim.net-1844575680-@...2470...> You means that fordeveloper any apps for ipod or iphones is with xcodes on mac? Not for other enviroments? Thanks Tomas Sent on the TELUS Mobility network with BlackBerry -----Original Message----- From: Phm Quang Dng soleilpqd at ...626... Date: Thu, 19 Aug 2010 17:55:42 To: mailing list for gambas users Reply-To: mailing list for gambas users Subject: Re: [Gambas-user] gambas for iphone or ipad apps As I know, there's no way to do that. The only way to develop app for Iphone ( and this app can run on device / sell on store ) is use xcode IDE running on Mac. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Gambas-user mailing list Gambas-user at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user From sourceforge-raindog2 at ...94... Thu Aug 19 16:26:49 2010 From: sourceforge-raindog2 at ...94... (Rob) Date: Thu, 19 Aug 2010 10:26:49 -0400 Subject: [Gambas-user] gambas for iphone or ipad apps In-Reply-To: References: Message-ID: <201008191026.50167.sourceforge-raindog2@...94...> On Thursday 19 August 2010 02:41, Tomas Rodriguez wrote: > I would like to know How can I developer apps for ipod or iphone with > gambas? According to Apple's own iPhone developer agreement, "Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs ..." So even if you were able to write programs for the iPhone in Gambas, doing so would get you rejected from the App Store. To develop more than web apps for the iPhone, you need to buy a Mac and learn Objective-C (which is their preferred language), C or C++. Most likely Objective-C, since C and C++ can be used in cross-platform toolkits and Apple is doing its best to kill those off. They might institute an Objective-C-only policy in the future. It may be possible to port Gambas and an X server to the iPhone/iPad for use by users with jailbroken devices, but without a profit or fame motive, I don't see anyone putting the effort into that. I already went down this path about a year ago, and Apple's only gotten stricter since then. Rob From nando_f at ...951... Thu Aug 19 17:40:27 2010 From: nando_f at ...951... (nando) Date: Thu, 19 Aug 2010 11:40:27 -0400 Subject: [Gambas-user] IDE editor (small) bug? Gambas 2.9 In-Reply-To: References: <20100818211749.M19625@...951...> Message-ID: <20100819153917.M80638@...951...> I thought it was a feature, but wasn't sure. I started using it. Perfect + Thanks! ---------- Original Message ----------- From: Fabien Bodard To: nando_f at ...951..., mailing list for gambas users Sent: Thu, 19 Aug 2010 09:19:51 +0200 Subject: Re: [Gambas-user] IDE editor (small) bug? Gambas 2.9 > 2010/8/18 nando : > > Example: > > > > IF X < 1 OR X > 100 THEN ? ? ? ? ? ? ? ? 'My comment here > > > > Highlight any part of the line then press the TAB key. > > Tabs are inserted at the beginning of the line. > > > > -Fernando > > > this is not a bug but a feature... when a part of a line is selected > the tab is added in the beginning of the line, and shift+tab remove it > (2 spaces in fact) > > this feature is to help in code indentation > > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by > > > > Make an app they can't live without > > Enter the BlackBerry Developer Challenge > > http://p.sf.net/sfu/RIM-dev2dev > > _______________________________________________ > > Gambas-user mailing list > > Gambas-user at lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user ------- End of Original Message ------- From jose2190 at ...626... Fri Aug 20 04:11:25 2010 From: jose2190 at ...626... (jose) Date: Thu, 19 Aug 2010 23:11:25 -0300 Subject: [Gambas-user] Gambas to python Message-ID: <1282270285.3900.0.camel@...2461...> Hello, I'm half a cumbersome problem, I try to run a shell to my mplayer variable declared as a process. What is the running mplayer python interactive console which I call a player, my problem is: Once called the SHELL ("python"), you run the console, but not how to enter new commands to the console. I tried to run SHELL ("import pygame") to write it in the terminal, but does not. Does anyone could tell me I'm doing wrong, or perhaps some example code? >From already thank you very much From ihaywood at ...1979... Fri Aug 20 06:21:13 2010 From: ihaywood at ...1979... (Ian Haywood) Date: Fri, 20 Aug 2010 14:21:13 +1000 Subject: [Gambas-user] Gambas to python In-Reply-To: <1282270285.3900.0.camel@...2461...> References: <1282270285.3900.0.camel@...2461...> Message-ID: On 8/20/10, jose wrote: > Hello, I'm half a cumbersome problem, I try to run a shell to my mplayer > variable declared as a process. > > What is the running mplayer python interactive console which I call a > player, my problem is: > > Once called the SHELL ("python"), you run the console, but not how to > enter new commands to the console. > > I tried to run SHELL ("import pygame") to write it in the terminal, but > does not. > > Does anyone could tell me I'm doing wrong, or perhaps some example code? Write a python program as a separate file (.py extension) and get it working to do what you want. Then run it from Gambas: Exec ["/usr/bin/python","/path/to/my/script.py"] Ian From gambas.fr at ...626... Fri Aug 20 07:47:39 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Fri, 20 Aug 2010 07:47:39 +0200 Subject: [Gambas-user] Gambas to python In-Reply-To: References: <1282270285.3900.0.camel@...2461...> Message-ID: you can use process for that ... and then write on this stream 2010/8/20 Ian Haywood : > On 8/20/10, jose wrote: >> Hello, I'm half a cumbersome problem, I try to run a shell to my mplayer >> variable declared as a process. >> >> What is the running mplayer python interactive console which I call a >> player, my problem is: >> >> Once called the SHELL ("python"), you run the console, but not how to >> enter new commands to the console. >> >> I tried to run SHELL ("import pygame") to write it in the terminal, but >> does not. >> >> Does anyone could tell me I'm doing wrong, or perhaps some example code? > Write a python program as a separate file (.py extension) and get it working > to do what you want. > > Then run it from Gambas: > > ?Exec ["/usr/bin/python","/path/to/my/script.py"] > > Ian > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From kevinfishburne at ...1887... Sat Aug 21 00:47:12 2010 From: kevinfishburne at ...1887... (kevinfishburne) Date: Fri, 20 Aug 2010 15:47:12 -0700 (PDT) Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: References: <29413575.post@...1379...> <201008120035.28033.gambas@...1...> <29413824.post@...1379...> <201008120134.21698.gambas@...1...> <29414425.post@...1379...> <201008122114.43582.gambas@...1...> <29476167.post@...1379...> Message-ID: <29496338.post@...1379...> Fabien Bodard-4 wrote: > > yes, take a look here : > http://gambasdoc.org/help/install > I just verified that the build dependencies were satisfied and recompiled GAMBAS 3: sudo apt-get install build-essential libffi-dev libbz2-dev libfbclient2 firebird2.1-dev libmysqlclient15-dev unixodbc-dev libpq-dev libsqlite0-dev libsqlite3-dev libxtst-dev libgtk2.0-dev libgtkglext1-dev librsvg2-dev libcurl4-gnutls-dev libpcre3-dev libpoppler-dev libpoppler-glib-dev libqt3-mt-dev kdelibs4-dev libsdl-image1.2-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libxml2-dev libxslt1-dev sudo rm -fr trunk mkdir trunk svn checkout https://gambas.svn.sourceforge.net/svnroot/gambas/gambas/trunk/ cd trunk ./reconf-all ./configure make sudo make install gambas3 The results were the same (program runs but PictureBox control remains black), so I tried creating a fresh GAMBAS 3 project: http://old.nabble.com/file/p29496338/gb.image_drawalpha.tar.bz2 gb.image_drawalpha.tar.bz2 It still won't display an image. I'd like to copy/paste the code for Image.DrawAlpha from the GAMBAS 3 checkout to the GAMBAS 2 checkout and see if it works under a more stable GAMBAS. Is there anything I should look for other than the obvious (to a non-C programmer) to make that work? ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:sales at ...1887... sales at ...1887... phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-image-alpha-channel-accessibility-tp29413575p29496338.html Sent from the gambas-user mailing list archive at Nabble.com. From iggy.budiman.it at ...626... Sat Aug 21 09:37:15 2010 From: iggy.budiman.it at ...626... (Iggy Budiman) Date: Sat, 21 Aug 2010 14:37:15 +0700 Subject: [Gambas-user] gambas for iphone or ipad apps In-Reply-To: References: Message-ID: <4C6F822B.7090307@...626...> What about android on arm? Gambas can compile in arm right? There's a lot of cheap (made in china) android tablet in the market. If gambas (ide and compiled app.) can run on those platform, I'd like to order some of those. Would be nice too, since we would be able to make android application using gambas, even develop on it too. salam -iggy On 08/19/2010 05:55 PM, Ph?m Quang D??ng wrote: > As I know, there's no way to do that. > The only way to develop app for Iphone ( and this app can run on device / > sell on store ) is use xcode IDE running on Mac. > From sourceforge-raindog2 at ...94... Sat Aug 21 19:50:44 2010 From: sourceforge-raindog2 at ...94... (Rob) Date: Sat, 21 Aug 2010 13:50:44 -0400 Subject: [Gambas-user] gambas for iphone or ipad apps In-Reply-To: <4C6F822B.7090307@...626...> References: <4C6F822B.7090307@...626...> Message-ID: <201008211350.44665.sourceforge-raindog2@...94...> On Saturday 21 August 2010 03:37, Iggy Budiman wrote: > What about android on arm? Gambas can compile in arm right? > There's a lot of cheap (made in china) android tablet in the market. > If gambas (ide and compiled app.) can run on those platform, I'd like to > order some of those. > Would be nice too, since we would be able to make android application > using gambas, even develop on it too. Android is Linux-based but doesn't run X. You code for it in Java using Google's own APIs. But they recently came out with a "native development kit" to allow easier porting of games, and it might be that parts of Gambas could be ported to that. Someone has started working on porting Qt to Android, also using the NDK. Until that's ready, you'd have to either roll your own interfaces in SDL or write your own widget set for Android, though (I think a gb.sdl.interface component has been a long time coming but haven't had time myself.) Either way, you'll be running into the problem that your apps don't look native, so you might as well just be writing a web app. But it should be possible. I've been writing Java code on and off for about 12 years, so I've been doing some Android development myself, using Eclipse and some plugins to make GUI development less of a pain. But it's not as elegant as Gambas, and likely never will be. Google also has "App Inventor", which allows you to make basic Android apps with little to no coding, but at a much higher level than Gambas, with far less control (they provide pre-coded graphical "blocks" to assemble your program logic, flowchart style, instead of controls and methods/properties like Gambas). It's more like one of the old game construction kits from the 90s than a development environment, but all they're doing is changing commands and parameters to little puzzle pieces you fit together into "blocks" that are essentially lines of code. You have to request an invitation, so I haven't tried it yet. I also don't think you can start an app in there and finish it by writing code in Eclipse. But I guess that's what I'd recommend trying for a Gambas programmer who wants to develop for Android, at least until someone ports Gambas in a way that makes it feel native. I've been waiting for a cheap Chinese tablet with a multitouch capacitative touchscreen as a test device, since most phones coming out now are multitouch and capacitative (use your finger, not a stylus). If you know of any like that and could send me a link privately, I'd appreciate it. Rob From bill-lancaster at ...2231... Sun Aug 22 11:33:14 2010 From: bill-lancaster at ...2231... (Bill-Lancaster) Date: Sun, 22 Aug 2010 02:33:14 -0700 (PDT) Subject: [Gambas-user] fit photo into picturebox Message-ID: <29503897.post@...1379...> Can anyone help me to fit a jpeg photo into a picturebox? PictureBox1.Picture = Picture.Load("dir/pic1.jpeg") shows only a small part of the photo. Thanks Bill Lancaster -- View this message in context: http://old.nabble.com/fit-photo-into-picturebox-tp29503897p29503897.html Sent from the gambas-user mailing list archive at Nabble.com. From Karl.Reinl at ...2345... Sun Aug 22 12:11:13 2010 From: Karl.Reinl at ...2345... (Charlie Reinl) Date: Sun, 22 Aug 2010 12:11:13 +0200 Subject: [Gambas-user] fit photo into picturebox In-Reply-To: <29503897.post@...1379...> References: <29503897.post@...1379...> Message-ID: <1282471873.6908.1.camel@...40...> Am Sonntag, den 22.08.2010, 02:33 -0700 schrieb Bill-Lancaster: > Can anyone help me to fit a jpeg photo into a picturebox? > > PictureBox1.Picture = Picture.Load("dir/pic1.jpeg") shows only a small part > of the photo. > > Thanks > > Bill Lancaster Salut, try to set in Properties : Stretch=true -- Amicalement Charlie From bill-lancaster at ...2231... Sun Aug 22 12:32:38 2010 From: bill-lancaster at ...2231... (Bill-Lancaster) Date: Sun, 22 Aug 2010 03:32:38 -0700 (PDT) Subject: [Gambas-user] fit photo into picturebox In-Reply-To: <1282471873.6908.1.camel@...40...> References: <29503897.post@...1379...> <1282471873.6908.1.camel@...40...> Message-ID: <29504130.post@...1379...> Thanks Charlie - works fine. I did try it earlier and my system hung-up so I presumed I'd done something stupid. Thanks again Bill Lancaster -- View this message in context: http://old.nabble.com/fit-photo-into-picturebox-tp29503897p29504130.html Sent from the gambas-user mailing list archive at Nabble.com. From kevinfishburne at ...1887... Sun Aug 22 17:22:26 2010 From: kevinfishburne at ...1887... (kevinfishburne) Date: Sun, 22 Aug 2010 08:22:26 -0700 (PDT) Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <29496338.post@...1379...> References: <29413575.post@...1379...> <201008120035.28033.gambas@...1...> <29413824.post@...1379...> <201008120134.21698.gambas@...1...> <29414425.post@...1379...> <201008122114.43582.gambas@...1...> <29476167.post@...1379...> <29496338.post@...1379...> Message-ID: <29504756.post@...1379...> kevinfishburne wrote: > > It still won't display an image. I'd like to copy/paste the code for > Image.DrawAlpha from the GAMBAS 3 checkout to the GAMBAS 2 checkout and > see if it works under a more stable GAMBAS. Is there anything I should > look for other than the obvious (to a non-C programmer) to make that work? > I found the relevant bits of code, but it looks like the code is quite a bit different between GAMBAS 2 and 3, so without knowing C I wasn't able to get the new code to compile properly. I guess I'll continue to wait until GAMBAS 3 has reached a stable enough point that I'm able to test the new function. ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:sales at ...1887... sales at ...1887... phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-image-alpha-channel-accessibility-tp29413575p29504756.html Sent from the gambas-user mailing list archive at Nabble.com. From gael.lehech at ...626... Mon Aug 23 11:30:15 2010 From: gael.lehech at ...626... (=?ISO-8859-1?Q?Ga=EBl_Le_Hec=27H?=) Date: Mon, 23 Aug 2010 11:30:15 +0200 Subject: [Gambas-user] Problem saving change in a form Message-ID: hi, I extracted the form from my project and put in a blank project. If I do any modification and try to save, I get this error : Cannot save file ! Null object (CControl.GetEachProperty.1226) It happen with gambas2-2.21.0_3124 and the project can be run without any error :-) best regards Ga?l Le Hec'H -------------- next part -------------- A non-text attachment was scrubbed... Name: snapshot.jpeg Type: image/jpeg Size: 17764 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 3-0.0.1.tar.gz Type: application/x-gzip Size: 25186 bytes Desc: not available URL: From ron at ...1740... Mon Aug 23 11:46:57 2010 From: ron at ...1740... (Ron) Date: Mon, 23 Aug 2010 11:46:57 +0200 Subject: [Gambas-user] Converting strings to numbers with localization issues Message-ID: <4C724391.2090605@...1740...> In my project I have several temp values in the form of 31.72 C They are stored as string and I convert them with Val(sValue) My project is translatable, default language is en_US.UTF-8 If I change System.Language, Val doesn't know how to convert the value correctly (or it does it correctly, but I have to change my code) Anyone had this problem and knows how to prevent the system from leaving out point or comma's or the complete value? Example project with output: ' Gambas module file PUBLIC SUB Main() DIM sValue AS String = "31,72" PRINT "Original Value -> " & sValue PRINT System.Language & " -> "; PRINT Val(sValue) System.Language = "nl_NL.UTF-8" PRINT System.Language & " -> "; PRINT Val(sValue) System.Language = "de_DE.UTF-8" PRINT System.Language & " -> "; PRINT Val(sValue) sValue = "31.72" PRINT "\nOriginal Value -> " & sValue PRINT System.Language & " -> "; PRINT Val(sValue) System.Language = "nl_NL.UTF-8" PRINT System.Language & " -> "; PRINT Val(sValue) System.Language = "de_DE.UTF-8" PRINT System.Language & " -> "; PRINT Val(sValue) END OUTPUT IS: Original Value -> 31,72 en_US.UTF-8 -> 3172 nl_NL.UTF-8 -> 31,72 de_DE.UTF-8 -> 31,72 Original Value -> 31.72 de_DE.UTF-8 -> 3172 nl_NL.UTF-8 -> de_DE.UTF-8 -> 3172 So if I store it with . or , it's false interpreted by at least one of the languages... I do not have the same values, I also store energy usage and other values in the form of 41.322 Watts, so the decimal point is not always at 2 I remember this type of discussion regarding currency, how was it solved? Please any input is welcome. Gambas2, gb.qt, Ubuntu 10.04 Regards, Ron_2nd. From gambas at ...1... Mon Aug 23 11:54:15 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 23 Aug 2010 11:54:15 +0200 Subject: [Gambas-user] Converting strings to numbers with localization issues In-Reply-To: <4C724391.2090605@...1740...> References: <4C724391.2090605@...1740...> Message-ID: <201008231154.15744.gambas@...1...> > In my project I have several temp values in the form of 31.72 C > > They are stored as string and I convert them with Val(sValue) > > My project is translatable, default language is en_US.UTF-8 > > If I change System.Language, Val doesn't know how to convert the value > correctly (or it does it correctly, but I have to change my code) > > Anyone had this problem and knows how to prevent the system from leaving > out point or comma's or the complete value? > > Example project with output: > > ' Gambas module file > > PUBLIC SUB Main() > > DIM sValue AS String = "31,72" > > PRINT "Original Value -> " & sValue > > PRINT System.Language & " -> "; > PRINT Val(sValue) > > System.Language = "nl_NL.UTF-8" > PRINT System.Language & " -> "; > PRINT Val(sValue) > > System.Language = "de_DE.UTF-8" > PRINT System.Language & " -> "; > PRINT Val(sValue) > > sValue = "31.72" > PRINT "\nOriginal Value -> " & sValue > > PRINT System.Language & " -> "; > PRINT Val(sValue) > > System.Language = "nl_NL.UTF-8" > PRINT System.Language & " -> "; > PRINT Val(sValue) > > System.Language = "de_DE.UTF-8" > PRINT System.Language & " -> "; > PRINT Val(sValue) > > END > > OUTPUT IS: > > Original Value -> 31,72 > en_US.UTF-8 -> 3172 > nl_NL.UTF-8 -> 31,72 > de_DE.UTF-8 -> 31,72 > > Original Value -> 31.72 > de_DE.UTF-8 -> 3172 > nl_NL.UTF-8 -> > de_DE.UTF-8 -> 3172 > > So if I store it with . or , it's false interpreted by at least one of > the languages... > I do not have the same values, I also store energy usage and other > values in the form of 41.322 Watts, so the decimal point is not always at 2 > > I remember this type of discussion regarding currency, how was it solved? > > Please any input is welcome. > > Gambas2, gb.qt, Ubuntu 10.04 > > Regards, > Ron_2nd. > The meaning of "." and "," in numbers changes with the language (the "localization"), and Val() follows the localization settings, so all that is logical. So use CFloat() instead of Val() to have a behaviour that does not depends on localization, and create your own conversion function with it. Regards, -- Beno?t Minisini From ron at ...1740... Mon Aug 23 12:07:05 2010 From: ron at ...1740... (Ron) Date: Mon, 23 Aug 2010 12:07:05 +0200 Subject: [Gambas-user] Converting strings to numbers with localization issues In-Reply-To: <201008231154.15744.gambas@...1...> References: <4C724391.2090605@...1740...> <201008231154.15744.gambas@...1...> Message-ID: <4C724849.9010102@...1740...> On 23-8-2010 11:54, Beno?t Minisini wrote: >> In my project I have several temp values in the form of 31.72 C >> >> They are stored as string and I convert them with Val(sValue) >> >> My project is translatable, default language is en_US.UTF-8 >> >> If I change System.Language, Val doesn't know how to convert the value >> correctly (or it does it correctly, but I have to change my code) >> >> Anyone had this problem and knows how to prevent the system from leaving >> out point or comma's or the complete value? >> >> Example project with output: >> >> ' Gambas module file >> >> PUBLIC SUB Main() >> >> DIM sValue AS String = "31,72" >> >> PRINT "Original Value -> "& sValue >> >> PRINT System.Language& " -> "; >> PRINT Val(sValue) >> >> System.Language = "nl_NL.UTF-8" >> PRINT System.Language& " -> "; >> PRINT Val(sValue) >> >> System.Language = "de_DE.UTF-8" >> PRINT System.Language& " -> "; >> PRINT Val(sValue) >> >> sValue = "31.72" >> PRINT "\nOriginal Value -> "& sValue >> >> PRINT System.Language& " -> "; >> PRINT Val(sValue) >> >> System.Language = "nl_NL.UTF-8" >> PRINT System.Language& " -> "; >> PRINT Val(sValue) >> >> System.Language = "de_DE.UTF-8" >> PRINT System.Language& " -> "; >> PRINT Val(sValue) >> >> END >> >> OUTPUT IS: >> >> Original Value -> 31,72 >> en_US.UTF-8 -> 3172 >> nl_NL.UTF-8 -> 31,72 >> de_DE.UTF-8 -> 31,72 >> >> Original Value -> 31.72 >> de_DE.UTF-8 -> 3172 >> nl_NL.UTF-8 -> >> de_DE.UTF-8 -> 3172 >> >> So if I store it with . or , it's false interpreted by at least one of >> the languages... >> I do not have the same values, I also store energy usage and other >> values in the form of 41.322 Watts, so the decimal point is not always at 2 >> >> I remember this type of discussion regarding currency, how was it solved? >> >> Please any input is welcome. >> >> Gambas2, gb.qt, Ubuntu 10.04 >> >> Regards, >> Ron_2nd. >> > The meaning of "." and "," in numbers changes with the language (the > "localization"), and Val() follows the localization settings, so all that is > logical. > > So use CFloat() instead of Val() to have a behaviour that does not depends on > localization, and create your own conversion function with it. > > Regards, > I have noticed that when using CFloat(sValue) I have to check/translate commas to dots first if found in string, otherwise CFloat says 'wanted float got string instead' Would be handy to know what Val() does behind the scene, do you know without having to search through your code? It's hard for me to find. Thanks Regards, Ron_2nd. From gambas at ...1... Mon Aug 23 12:19:19 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 23 Aug 2010 12:19:19 +0200 Subject: [Gambas-user] Converting strings to numbers with localization issues In-Reply-To: <4C724849.9010102@...1740...> References: <4C724391.2090605@...1740...> <201008231154.15744.gambas@...1...> <4C724849.9010102@...1740...> Message-ID: <201008231219.19248.gambas@...1...> > On 23-8-2010 11:54, Beno?t Minisini wrote: > >> In my project I have several temp values in the form of 31.72 C > >> > >> They are stored as string and I convert them with Val(sValue) > >> > >> My project is translatable, default language is en_US.UTF-8 > >> > >> If I change System.Language, Val doesn't know how to convert the value > >> correctly (or it does it correctly, but I have to change my code) > >> > >> Anyone had this problem and knows how to prevent the system from leaving > >> out point or comma's or the complete value? > >> > >> Example project with output: > >> > >> ' Gambas module file > >> > >> PUBLIC SUB Main() > >> > >> DIM sValue AS String = "31,72" > >> > >> PRINT "Original Value -> "& sValue > >> > >> PRINT System.Language& " -> "; > >> PRINT Val(sValue) > >> > >> System.Language = "nl_NL.UTF-8" > >> PRINT System.Language& " -> "; > >> PRINT Val(sValue) > >> > >> System.Language = "de_DE.UTF-8" > >> PRINT System.Language& " -> "; > >> PRINT Val(sValue) > >> > >> sValue = "31.72" > >> PRINT "\nOriginal Value -> "& sValue > >> > >> PRINT System.Language& " -> "; > >> PRINT Val(sValue) > >> > >> System.Language = "nl_NL.UTF-8" > >> PRINT System.Language& " -> "; > >> PRINT Val(sValue) > >> > >> System.Language = "de_DE.UTF-8" > >> PRINT System.Language& " -> "; > >> PRINT Val(sValue) > >> > >> END > >> > >> OUTPUT IS: > >> > >> Original Value -> 31,72 > >> en_US.UTF-8 -> 3172 > >> nl_NL.UTF-8 -> 31,72 > >> de_DE.UTF-8 -> 31,72 > >> > >> Original Value -> 31.72 > >> de_DE.UTF-8 -> 3172 > >> nl_NL.UTF-8 -> > >> de_DE.UTF-8 -> 3172 > >> > >> So if I store it with . or , it's false interpreted by at least one of > >> the languages... > >> I do not have the same values, I also store energy usage and other > >> values in the form of 41.322 Watts, so the decimal point is not always > >> at 2 > >> > >> I remember this type of discussion regarding currency, how was it > >> solved? > >> > >> Please any input is welcome. > >> > >> Gambas2, gb.qt, Ubuntu 10.04 > >> > >> Regards, > >> Ron_2nd. > > > > The meaning of "." and "," in numbers changes with the language (the > > "localization"), and Val() follows the localization settings, so all that > > is logical. > > > > So use CFloat() instead of Val() to have a behaviour that does not > > depends on localization, and create your own conversion function with > > it. > > > > Regards, > > I have noticed that when using CFloat(sValue) I have to check/translate > commas to dots first if found in string, otherwise CFloat says 'wanted > float got string instead' > > Would be handy to know what Val() does behind the scene, do you know > without having to search through your code? It's hard for me to find. > > Thanks > > Regards, > Ron_2nd. > What Val() does is explained in its wiki documentation page. What information do you need that is not in that page? -- Beno?t Minisini From ron at ...1740... Mon Aug 23 12:34:49 2010 From: ron at ...1740... (Ron) Date: Mon, 23 Aug 2010 12:34:49 +0200 Subject: [Gambas-user] Converting strings to numbers with localization issues In-Reply-To: <201008231219.19248.gambas@...1...> References: <4C724391.2090605@...1740...> <201008231154.15744.gambas@...1...> <4C724849.9010102@...1740...> <201008231219.19248.gambas@...1...> Message-ID: <4C724EC9.7090700@...1740...> On 23-8-2010 12:19, Beno?t Minisini wrote: >> On 23-8-2010 11:54, Beno?t Minisini wrote: >>>> In my project I have several temp values in the form of 31.72 C >>>> >>>> They are stored as string and I convert them with Val(sValue) >>>> >>>> My project is translatable, default language is en_US.UTF-8 >>>> >>>> If I change System.Language, Val doesn't know how to convert the value >>>> correctly (or it does it correctly, but I have to change my code) >>>> >>>> Anyone had this problem and knows how to prevent the system from leaving >>>> out point or comma's or the complete value? >>>> >>>> Example project with output: >>>> >>>> ' Gambas module file >>>> >>>> PUBLIC SUB Main() >>>> >>>> DIM sValue AS String = "31,72" >>>> >>>> PRINT "Original Value -> "& sValue >>>> >>>> PRINT System.Language& " -> "; >>>> PRINT Val(sValue) >>>> >>>> System.Language = "nl_NL.UTF-8" >>>> PRINT System.Language& " -> "; >>>> PRINT Val(sValue) >>>> >>>> System.Language = "de_DE.UTF-8" >>>> PRINT System.Language& " -> "; >>>> PRINT Val(sValue) >>>> >>>> sValue = "31.72" >>>> PRINT "\nOriginal Value -> "& sValue >>>> >>>> PRINT System.Language& " -> "; >>>> PRINT Val(sValue) >>>> >>>> System.Language = "nl_NL.UTF-8" >>>> PRINT System.Language& " -> "; >>>> PRINT Val(sValue) >>>> >>>> System.Language = "de_DE.UTF-8" >>>> PRINT System.Language& " -> "; >>>> PRINT Val(sValue) >>>> >>>> END >>>> >>>> OUTPUT IS: >>>> >>>> Original Value -> 31,72 >>>> en_US.UTF-8 -> 3172 >>>> nl_NL.UTF-8 -> 31,72 >>>> de_DE.UTF-8 -> 31,72 >>>> >>>> Original Value -> 31.72 >>>> de_DE.UTF-8 -> 3172 >>>> nl_NL.UTF-8 -> >>>> de_DE.UTF-8 -> 3172 >>>> >>>> So if I store it with . or , it's false interpreted by at least one of >>>> the languages... >>>> I do not have the same values, I also store energy usage and other >>>> values in the form of 41.322 Watts, so the decimal point is not always >>>> at 2 >>>> >>>> I remember this type of discussion regarding currency, how was it >>>> solved? >>>> >>>> Please any input is welcome. >>>> >>>> Gambas2, gb.qt, Ubuntu 10.04 >>>> >>>> Regards, >>>> Ron_2nd. >>> The meaning of "." and "," in numbers changes with the language (the >>> "localization"), and Val() follows the localization settings, so all that >>> is logical. >>> >>> So use CFloat() instead of Val() to have a behaviour that does not >>> depends on localization, and create your own conversion function with >>> it. >>> >>> Regards, >> I have noticed that when using CFloat(sValue) I have to check/translate >> commas to dots first if found in string, otherwise CFloat says 'wanted >> float got string instead' >> >> Would be handy to know what Val() does behind the scene, do you know >> without having to search through your code? It's hard for me to find. >> >> Thanks >> >> Regards, >> Ron_2nd. >> > What Val() does is explained in its wiki documentation page. What information > do you need that is not in that page? > I was thinking about the code behind it, but it's not important. One last question, is the behaviour below normal? The first CFloat (en_US) returns a dot while the rest returns a comma in the result, ie the are not consistant either, I must have overlooked something..or .? PUBLIC SUB Main() DIM sValue AS String = "31,72" ' replace , by . sValue = Replace(sValue, ",", ".", gb.String) PRINT "Original Value -> " & sValue PRINT System.Language & " -> "; PRINT CFloat(sValue) System.Language = "nl_NL.UTF-8" PRINT System.Language & " -> "; PRINT CFloat(sValue) System.Language = "de_DE.UTF-8" PRINT System.Language & " -> "; PRINT CFloat(sValue) END OUTPUTS: Original Value -> 31.72 en_US.UTF-8 -> 31.72 nl_NL.UTF-8 -> 31,72 de_DE.UTF-8 -> 31,72 Regards, Ron_2nd. From gambas.fr at ...626... Mon Aug 23 14:28:30 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Mon, 23 Aug 2010 14:28:30 +0200 Subject: [Gambas-user] Converting strings to numbers with localization issues In-Reply-To: <4C724EC9.7090700@...1740...> References: <4C724391.2090605@...1740...> <201008231154.15744.gambas@...1...> <4C724849.9010102@...1740...> <201008231219.19248.gambas@...1...> <4C724EC9.7090700@...1740...> Message-ID: CFLoat return a Float variable ... so PRINT just see a variable and not a convertion funtion ... PRINT do what it do for every float, display the number in localization settings. 2010/8/23 Ron : > ?On 23-8-2010 12:19, Beno?t Minisini wrote: >>> ? ?On 23-8-2010 11:54, Beno?t Minisini wrote: >>>>> ? ? In my project I have several temp values in the form of 31.72 C >>>>> >>>>> They are stored as string and I convert them with Val(sValue) >>>>> >>>>> My project is translatable, default language is en_US.UTF-8 >>>>> >>>>> If I change System.Language, Val doesn't know how to convert the value >>>>> correctly (or it does it correctly, but I have to change my code) >>>>> >>>>> Anyone had this problem and knows how to prevent the system from leaving >>>>> out point or comma's or the complete value? >>>>> >>>>> Example project with output: >>>>> >>>>> ' Gambas module file >>>>> >>>>> PUBLIC SUB Main() >>>>> >>>>> ? ? ?DIM sValue AS String = "31,72" >>>>> >>>>> ? ? ?PRINT "Original Value -> ? "& ? sValue >>>>> >>>>> ? ? ?PRINT System.Language& ? " -> ? "; >>>>> ? ? ?PRINT Val(sValue) >>>>> >>>>> ? ? ?System.Language = "nl_NL.UTF-8" >>>>> ? ? ?PRINT System.Language& ? " -> ? "; >>>>> ? ? ?PRINT Val(sValue) >>>>> >>>>> ? ? ?System.Language = "de_DE.UTF-8" >>>>> ? ? ?PRINT System.Language& ? " -> ? "; >>>>> ? ? ?PRINT Val(sValue) >>>>> >>>>> ? ? ?sValue = "31.72" >>>>> ? ? ?PRINT "\nOriginal Value -> ? "& ? sValue >>>>> >>>>> ? ? ?PRINT System.Language& ? " -> ? "; >>>>> ? ? ?PRINT Val(sValue) >>>>> >>>>> ? ? ?System.Language = "nl_NL.UTF-8" >>>>> ? ? ?PRINT System.Language& ? " -> ? "; >>>>> ? ? ?PRINT Val(sValue) >>>>> >>>>> ? ? ?System.Language = "de_DE.UTF-8" >>>>> ? ? ?PRINT System.Language& ? " -> ? "; >>>>> ? ? ?PRINT Val(sValue) >>>>> >>>>> END >>>>> >>>>> OUTPUT IS: >>>>> >>>>> Original Value -> ? 31,72 >>>>> en_US.UTF-8 -> ? 3172 >>>>> nl_NL.UTF-8 -> ? 31,72 >>>>> de_DE.UTF-8 -> ? 31,72 >>>>> >>>>> Original Value -> ? 31.72 >>>>> de_DE.UTF-8 -> ? 3172 >>>>> nl_NL.UTF-8 -> >>>>> de_DE.UTF-8 -> ? 3172 >>>>> >>>>> So if I store it with . or , it's false interpreted by at least one of >>>>> the languages... >>>>> I do not have the same values, I also store energy usage and other >>>>> values in the form of 41.322 Watts, so the decimal point is not always >>>>> at 2 >>>>> >>>>> I remember this type of discussion regarding currency, how was it >>>>> solved? >>>>> >>>>> Please any input is welcome. >>>>> >>>>> Gambas2, gb.qt, Ubuntu 10.04 >>>>> >>>>> Regards, >>>>> Ron_2nd. >>>> The meaning of "." and "," in numbers changes with the language (the >>>> "localization"), and Val() follows the localization settings, so all that >>>> is logical. >>>> >>>> So use CFloat() instead of Val() to have a behaviour that does not >>>> depends on localization, and create your own conversion function with >>>> it. >>>> >>>> Regards, >>> I have noticed that when using CFloat(sValue) ?I have to check/translate >>> commas to dots first if found in string, otherwise CFloat says 'wanted >>> float got string instead' >>> >>> Would be handy to know what Val() does behind the scene, do you know >>> without having to search through your code? It's hard for me to find. >>> >>> Thanks >>> >>> Regards, >>> Ron_2nd. >>> >> What Val() does is explained in its wiki documentation page. What information >> do you need that is not in that page? >> > > I was thinking about the code behind it, but it's not important. > > One last question, is the behaviour below normal? > The first CFloat (en_US) returns a dot while the rest returns a comma in > the result, ie the are not consistant either, I must have overlooked > something..or .? > > PUBLIC SUB Main() > > ? DIM sValue AS String = "31,72" > > ? ' replace , by . > ? sValue = Replace(sValue, ",", ".", gb.String) > > ? PRINT "Original Value -> " & sValue > > ? PRINT System.Language & " -> "; > ? PRINT CFloat(sValue) > > ? System.Language = "nl_NL.UTF-8" > ? PRINT System.Language & " -> "; > ? PRINT CFloat(sValue) > > ? System.Language = "de_DE.UTF-8" > ? PRINT System.Language & " -> "; > ? PRINT CFloat(sValue) > > END > > OUTPUTS: > > Original Value -> 31.72 > en_US.UTF-8 -> 31.72 > nl_NL.UTF-8 -> 31,72 > de_DE.UTF-8 -> 31,72 > > Regards, > Ron_2nd. > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From ron at ...1740... Mon Aug 23 14:55:16 2010 From: ron at ...1740... (Ron) Date: Mon, 23 Aug 2010 14:55:16 +0200 Subject: [Gambas-user] Converting strings to numbers with localization issues In-Reply-To: References: <4C724391.2090605@...1740...> <201008231154.15744.gambas@...1...> <4C724849.9010102@...1740...> <201008231219.19248.gambas@...1...> <4C724EC9.7090700@...1740...> Message-ID: <4C726FB4.5080002@...1740...> Fabien, you are right, of course... they will be translated by Str$ I changed PRINT to WRITE just to test, and the pattern is the same for all 4. Finally a way to get this fixed, now I have to check my massive project for my wrongly used Val()'s Thanks both Beno?t and Fabien. Regards, Ron_2nd. > CFLoat return a Float variable ... so PRINT just see a variable and > not a convertion funtion ... PRINT do what it do for every float, > display the number in localization settings. > > > > 2010/8/23 Ron: >> On 23-8-2010 12:19, Beno?t Minisini wrote: >>>> On 23-8-2010 11:54, Beno?t Minisini wrote: >>>>>> In my project I have several temp values in the form of 31.72 C >>>>>> >>>>>> They are stored as string and I convert them with Val(sValue) >>>>>> >>>>>> My project is translatable, default language is en_US.UTF-8 >>>>>> >>>>>> If I change System.Language, Val doesn't know how to convert the value >>>>>> correctly (or it does it correctly, but I have to change my code) >>>>>> >>>>>> Anyone had this problem and knows how to prevent the system from leaving >>>>>> out point or comma's or the complete value? >>>>>> >>>>>> Example project with output: >>>>>> >>>>>> ' Gambas module file >>>>>> >>>>>> PUBLIC SUB Main() >>>>>> >>>>>> DIM sValue AS String = "31,72" >>>>>> >>>>>> PRINT "Original Value -> "& sValue >>>>>> >>>>>> PRINT System.Language& " -> "; >>>>>> PRINT Val(sValue) >>>>>> >>>>>> System.Language = "nl_NL.UTF-8" >>>>>> PRINT System.Language& " -> "; >>>>>> PRINT Val(sValue) >>>>>> >>>>>> System.Language = "de_DE.UTF-8" >>>>>> PRINT System.Language& " -> "; >>>>>> PRINT Val(sValue) >>>>>> >>>>>> sValue = "31.72" >>>>>> PRINT "\nOriginal Value -> "& sValue >>>>>> >>>>>> PRINT System.Language& " -> "; >>>>>> PRINT Val(sValue) >>>>>> >>>>>> System.Language = "nl_NL.UTF-8" >>>>>> PRINT System.Language& " -> "; >>>>>> PRINT Val(sValue) >>>>>> >>>>>> System.Language = "de_DE.UTF-8" >>>>>> PRINT System.Language& " -> "; >>>>>> PRINT Val(sValue) >>>>>> >>>>>> END >>>>>> >>>>>> OUTPUT IS: >>>>>> >>>>>> Original Value -> 31,72 >>>>>> en_US.UTF-8 -> 3172 >>>>>> nl_NL.UTF-8 -> 31,72 >>>>>> de_DE.UTF-8 -> 31,72 >>>>>> >>>>>> Original Value -> 31.72 >>>>>> de_DE.UTF-8 -> 3172 >>>>>> nl_NL.UTF-8 -> >>>>>> de_DE.UTF-8 -> 3172 >>>>>> >>>>>> So if I store it with . or , it's false interpreted by at least one of >>>>>> the languages... >>>>>> I do not have the same values, I also store energy usage and other >>>>>> values in the form of 41.322 Watts, so the decimal point is not always >>>>>> at 2 >>>>>> >>>>>> I remember this type of discussion regarding currency, how was it >>>>>> solved? >>>>>> >>>>>> Please any input is welcome. >>>>>> >>>>>> Gambas2, gb.qt, Ubuntu 10.04 >>>>>> >>>>>> Regards, >>>>>> Ron_2nd. >>>>> The meaning of "." and "," in numbers changes with the language (the >>>>> "localization"), and Val() follows the localization settings, so all that >>>>> is logical. >>>>> >>>>> So use CFloat() instead of Val() to have a behaviour that does not >>>>> depends on localization, and create your own conversion function with >>>>> it. >>>>> >>>>> Regards, >>>> I have noticed that when using CFloat(sValue) I have to check/translate >>>> commas to dots first if found in string, otherwise CFloat says 'wanted >>>> float got string instead' >>>> >>>> Would be handy to know what Val() does behind the scene, do you know >>>> without having to search through your code? It's hard for me to find. >>>> >>>> Thanks >>>> >>>> Regards, >>>> Ron_2nd. >>>> >>> What Val() does is explained in its wiki documentation page. What information >>> do you need that is not in that page? >>> >> I was thinking about the code behind it, but it's not important. >> >> One last question, is the behaviour below normal? >> The first CFloat (en_US) returns a dot while the rest returns a comma in >> the result, ie the are not consistant either, I must have overlooked >> something..or .? >> >> PUBLIC SUB Main() >> >> DIM sValue AS String = "31,72" >> >> ' replace , by . >> sValue = Replace(sValue, ",", ".", gb.String) >> >> PRINT "Original Value -> "& sValue >> >> PRINT System.Language& " -> "; >> PRINT CFloat(sValue) >> >> System.Language = "nl_NL.UTF-8" >> PRINT System.Language& " -> "; >> PRINT CFloat(sValue) >> >> System.Language = "de_DE.UTF-8" >> PRINT System.Language& " -> "; >> PRINT CFloat(sValue) >> >> END >> >> OUTPUTS: >> >> Original Value -> 31.72 >> en_US.UTF-8 -> 31.72 >> nl_NL.UTF-8 -> 31,72 >> de_DE.UTF-8 -> 31,72 >> >> Regards, >> Ron_2nd. >> >> > e.net/lists/listinfo/gambas-user From jussi.lahtinen at ...626... Mon Aug 23 15:36:04 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Mon, 23 Aug 2010 16:36:04 +0300 Subject: [Gambas-user] Problem saving change in a form In-Reply-To: References: Message-ID: I tested it with same revision of Gambas, @ Ubuntu 10.04 64bit, and I couldn't reproduce the problem. Jussi On Mon, Aug 23, 2010 at 12:30, Ga?l Le Hec'H wrote: > hi, > I extracted the form from my project and put in a blank project. If I > do any modification and try to save, I get this error : > Cannot save file ! Null object (CControl.GetEachProperty.1226) > It happen with gambas2-2.21.0_3124 and the project can be run without > any error :-) > best regards > Ga?l Le Hec'H > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > > From gael.lehech at ...626... Mon Aug 23 16:09:37 2010 From: gael.lehech at ...626... (=?ISO-8859-1?Q?Ga=EBl_Le_Hec=27H?=) Date: Mon, 23 Aug 2010 16:09:37 +0200 Subject: [Gambas-user] Problem saving change in a form In-Reply-To: References: Message-ID: I tested with stable 2.21 and was ok but not with 2.21_3124 very strange. will try to rebuild Gambas2 from SVN. From gambas at ...1... Mon Aug 23 16:53:24 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 23 Aug 2010 16:53:24 +0200 Subject: [Gambas-user] gb.image: image alpha channel accessibility In-Reply-To: <29504756.post@...1379...> References: <29413575.post@...1379...> <29496338.post@...1379...> <29504756.post@...1379...> Message-ID: <201008231653.24078.gambas@...1...> > kevinfishburne wrote: > > It still won't display an image. I'd like to copy/paste the code for > > Image.DrawAlpha from the GAMBAS 3 checkout to the GAMBAS 2 checkout and > > see if it works under a more stable GAMBAS. Is there anything I should > > look for other than the obvious (to a non-C programmer) to make that > > work? > > I found the relevant bits of code, but it looks like the code is quite a > bit different between GAMBAS 2 and 3, so without knowing C I wasn't able > to get the new code to compile properly. I guess I'll continue to wait > until GAMBAS 3 has reached a stable enough point that I'm able to test the > new function. > I tested your project, and it works when the form has Border = True. But the DrawingArea contents is not visible when Border = False. Strange bug, apparently related to the Border property, not to the drawing routines. Regards, -- Beno?t Minisini From gambas at ...1... Mon Aug 23 16:58:34 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 23 Aug 2010 16:58:34 +0200 Subject: [Gambas-user] Bug in TrayIcon In-Reply-To: References: Message-ID: <201008231658.34904.gambas@...1...> > Hi! > TrayIcon seems to work perfectly, > until program that uses it, is started at startup of OS. > Program is started with following command; > gbr2 /home/MyName/ProgramsName.gambas > > > Program has following code: > > PUBLIC Kuvake AS NEW TrayIcon AS "TrayIkoni" > > PUBLIC SUB Form_Open() > > Kuvake.Picture = Picture.Load("ikoni.png") > Kuvake.Show() > > .... > > > Following problems: > With GTK+, trayicon never appears, everything else works fine. > With Qt, error message at startup: > " > This application has raised an unexpected error and must abort. > Embedding has failed. > FMain.?.0 > " > > Gambas 2.21 revision 3124 @ Ubuntu 10.04 64bit > > Jussi > The TrayIcon must be embedded in a System tray to work. The system tray is (usually) managed by the desktop panel, so maybe your desktop panel is not yet visible when your program is run? -- Beno?t Minisini From gambas at ...1... Mon Aug 23 17:03:43 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 23 Aug 2010 17:03:43 +0200 Subject: [Gambas-user] EXEC or SHELL can not READ WRITE simultaneously well with process? In-Reply-To: References: <201008152218.52770.gambas@...1...> Message-ID: <201008231703.43786.gambas@...1...> > 1. Thank you for your response, it works better now. > > 2.The problem of shortcuts keys Ctrl+C, Ctrl+X is: when I use those > shortcut keys, I can paste only to the Gambas project editor window from > where I copy (I can paste to different tabs). When I switch to other > windows e.g gedit or an other Gambas project window, there's nothing to > paste. But when return to the first Gambas project window, I still can > paste. It's like that the shortcut keys use a "local clipboard" not the > clipboard of system. But this problem doesn't happen with the context > menu. (Paste here include both Ctrl+V and menu). Strange: it works perfectly as expected there. I copy some text with CTRL+C, and I paste it in gedit with CTRL+V, and that works! Regards, -- Beno?t Minisini From jussi.lahtinen at ...626... Mon Aug 23 17:27:53 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Mon, 23 Aug 2010 18:27:53 +0300 Subject: [Gambas-user] Bug in TrayIcon In-Reply-To: <201008231658.34904.gambas@...1...> References: <201008231658.34904.gambas@...1...> Message-ID: Yes, I modified startup, now there is 10s delay before starting gbr2. And everything works. Maybe I should write function to check if desktop panel is started or not. BTW. Does anyone know why sleep 10 && gbr2 ... doesn't work? It works in terminal, but in System --> Preferences --> Startup Applications, it doesn't. I had to do this via script to make it work. Is this some linux restriction or bug in Ubuntu? Jussi 2010/8/23 Beno?t Minisini : >> Hi! >> TrayIcon seems to work perfectly, >> until program that uses it, is started at startup of OS. >> Program is started with following command; >> gbr2 /home/MyName/ProgramsName.gambas >> >> >> Program has following code: >> >> PUBLIC Kuvake AS NEW TrayIcon AS "TrayIkoni" >> >> PUBLIC SUB Form_Open() >> >> ? Kuvake.Picture = Picture.Load("ikoni.png") >> ? Kuvake.Show() >> >> .... >> >> >> Following problems: >> With GTK+, trayicon never appears, everything else works fine. >> With Qt, error message at startup: >> " >> This application has raised an unexpected error and must abort. >> Embedding has failed. >> FMain.?.0 >> " >> >> Gambas 2.21 revision 3124 @ Ubuntu 10.04 64bit >> >> Jussi >> > > The TrayIcon must be embedded in a System tray to work. The system tray is > (usually) managed by the desktop panel, so maybe your desktop panel is not yet > visible when your program is run? > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From doriano.blengino at ...1909... Mon Aug 23 18:33:58 2010 From: doriano.blengino at ...1909... (Doriano Blengino) Date: Mon, 23 Aug 2010 18:33:58 +0200 Subject: [Gambas-user] Extern howto/tutorial In-Reply-To: References: <201008231658.34904.gambas@...1...> Message-ID: <4C72A2F6.2040103@...1909...> Hi, I finally wrote the tutorial about using external declarations. It is a long text and perhaps difficult, but I didn't find any other way to put it in a simpler form: the problem of interfacing gambas to external libraries, from the perspective of a gambas user, is not simple. I wrote it using zim, a nice wiki editor. I attach what I exported from the document, in both html and "Txt2Tags" (?) format. Feel free to modify it as needed, to include it in the wiki, or whatever. I attach two projects related to the explanation, one short and simple and one much more complex, but more funny. This document regards Gambas2. When it will be corrected/approved, I will port projects and documentation to Gambas3. Now some technical question. In the Drum Machine project, after having verified that it works correctly using pointers for read/write, I tried to create a new class which should be a gambas representation for an alsa event (which is a C struct). It does not work, and I don't know how to debug it (well, I could, using gdb or similar, but I was looking for a more direct way). My idea was to point a pointer to the instance of the class CEvent, and then dump a few bytes to see them. But gambas does not let me to assign a pointer to a class instance ("wanted integer, found object"). Moreover, in the gambas 3 documentation there is nothing that makes me think that "write #pointer, ..." is no more supported. Either gambas3 supports it (but it does not seems to me), or the documentation is wrong. Another thing is that if I declare a constant as a byte, and then try to "write #pointer, my_byte_constant", 4 bytes are written instead of just one. I had to mention it in the document. I am really curious to give a try to gambas3 structures, but I want firstly terminate with gambas2. Best regards, Doriano Blengino -------------- next part -------------- A non-text attachment was scrubbed... Name: Gambas2-DrumMachine-0.1.3.tar.gz Type: application/x-tgz Size: 15831 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: External-gb2-0.0.2.tar.gz Type: application/x-tgz Size: 17609 bytes Desc: not available URL: -------------- next part -------------- [ Prev ] [ [1]Index ] [ Next ] _________________________________________________________________ Home Created sabato 10 luglio 2010 How to interface Gambas to external libraries INTRODUCTION There are lots of shared libraries available in a Linux system, capable of doing a lot of useful things, and many of those libraries can be used from Gambas using some of its features. The first step to do is to find a suitable library to use for a given purpose; not all the libraries can be used, but the vast majority can. The prerequisite is that the library is written in plain C. Most libraries are written in C, while others are written in C++ and, perhaps, still other languages. This document will focus only about C libraries. Once the intended library is found, its general logic must be understood in order to determine what is needed, and how this new stuff will be used by the final program. The full documentation of the library, and possibly some example, should be readed carefully. Libraries are not programs, and hence their philosophy is quite different. A program tends to contain only the subroutines required to do its job, while a library is what the name implies: a collection of subroutines, to be used many times, by many different programs. It is not uncommon to find, inside libraries, two or more subroutines which do the same thing, in a slightly different way. Libraries sometimes are written keeping in mind that they will be used by different languages, not only C: python, ruby, ocaml, many others, Gambas included. Libraries tend to encapsulate the details of a task inside a "handle", in a way similar to a Gambas object; but, they don't have properties and methods - everything is carried out by calling functions which these handles are passed to. If you think at a Gambas class with three properties and four methods, an external library implementing the same thing will have at least seven (three+four) subroutines, and probably a couple more to create and destroy the object. Other than this, there is not a big difference from setting a property and calling a function, the latter is simply a bit longer to write. To search for what we need, we must be prepared to read a lot of documentation, too often badly written (hey, apropos, how well do we document our software?). THE EXTERN DECLARATION Extern declaration is simple. It is like a normal Gambas subroutine declaration, but preceded by "EXTERN". The EXTERN keyword says to gambas that the body of the procedure is not defined by the gambas program we are writing, but somewhere else (an external library). We must also specify which library to use: this is done by the clause "IN libraryXXX". Alternatively, you can use a separate LIBRARY statement: all the subsequent extern declarations will refer to this statement. Either "IN library" or "LIBRARY xxx" can specify a version number after a colon, and this is recommended. Let's see an example, choosen because of its simplicity: LIBRARY "libc:6" EXTERN getgid() AS Integer These two lines say that a function named "getgid" exists in the library "libc" version 6. This function takes no parameters, and returns an integer (the group ID). The same thing can be written like this: EXTERN getgid() AS Integer IN "libc:6" Another example, slightly more complicated. This time we have parameters, and the last thing to say about the formal declaration: ' int kill(pid_t pid, int sig); EXTERN killme(pid AS Integer, sig AS Integer) AS Integer IN "libc:6" EXEC "kill " The first line (the comment) shows the original declaration, and the second line the gambas one. We can note a number of things. First, what does the original declaration mean? It means "a function called kill returns an int, and it accepts two parameters. The first is named pid and its type is pid_t; the second is named sig and its type is int". Contrary to Gambas, the C language puts the type of a variable before the variable instead of after. Second, what in Gambas is called "Integer", in C is called "int". Third, what is "pid_t"? It's a type; we can understand it because it is written in a place where a type specifier is expected, and because ends with "_t" (underscore t). Third, a new clause EXEC "kill" is used in the Gambas declaration. This is necessary because we want to use a function named kill, but KILL is a name already used by Gambas. So, in Gambas, we must name the function differently, but anyway we must indicate its true name inside the library. The declaration says "I declare an external function named killme, but its real name is kill". I chose the name killme because in the attached gambas example this function is used to kill the running program. To be sincere I noticed that, even without renaming the function from kill to killme, the program was working the same. May be that this has something to do with case sensitivity - C is sensitive, and Gambas not, so there is still a difference between kill (lowercase) and KILL (uppercase). Anyway, when there is a possible name conflict, it is best to use this renaming technique. WARNING --- END OF THE EASY PART (just joking) At this point, several things must be noted. Most of the suitable libraries are written in C, which is a different language than Gambas. We will need to know at least a little of C declarations, in order to translate them to gambas. Referring to the last example, one could ask why I translated the pid_t type to integer. The simple and correct answer is "because on my system the pid_t type is actually an integer". This answer is really correct, but must be explained better, talking about agrumes (?). We can think about lemons and oranges, which both are agrumes, and are very similar: they weight more or less the same, and often can be interchanged; you can eat them directly, or squeeze them to drink their juice, but it is unlikely that you will put orange juice on your fried fish. In C, this is expressed by the fact that it is unlikely that you want to use the kill() function passing it an arbitrary integer. Surely, you will pass a process identifier (PID), which actually is an integer, but it is indicated more precisely as pid_t. In my motivation, I also said "on my system the pid_t type...". Yes, on my system - on most system, the type pid_t is an integer, but this could be different. The final answer can be found by typing these two commands in a terminal: grep -r pid_t /usr/include/* |grep "#define" grep -r pid_t /usr/include/* |grep typedef which will show the involuted way types are managed in C. This argument is way too complicated to go further; giving that Gambas runs on Linux, and presumably on desktop systems, we can consider that all the parameters passed to a function, and returned by it, will be either integer, or pointers - which are integer too, or strings - which are pointers that are integers. There can be also floating point numbers - float and double. The following table lists some of the types you can encounter in a C declaration, and the suitable type to be used in gambas: C type Gambas type int -> integer long -> long float -> single double -> float xxxx* -> pointer (the asterisk means exactly "pointer") char* -> pointer - but see later other types -> integer or pointer (depends on the declaration); see la ter We will start to briefly introduce pointers, which are little used in Gambas. A pointer is an integer, but used very differently. The thing that more closely resembles a pointer in Gambas is a class instance. When you create, say, a Form in Gambas, a lot of data is stored somewhere in memory. That memory will hold all the specific settings of the form: its caption, its color, the list of all its children, and so on. The address of that block of memory is returned to your program, and stored into the variable which refers to the just created form: MainForm = NEW Form() That variable MainForm is really a pointer: in only 4 (or 8) bytes it tracks a lot of data, stored somewhere in memory at a specific location (address). The memory is a long sequence of cells (bytes), each identified by a progressive number. A pointer contains the identifying number of a cell of memory (its address). In C, pointers are used for two reasons: the first is that passing only an address (a pointer contains an address), is much quicker than passing a lot of data; this is the same reason why Gambas instance variables like MainForm are similar to pointers. The second reason is when the called function should modify the variable we pass. For example, if we in Gambas wrote: INPUT a ' where a is an integer in C we would write: void input(int *a); ... input(&a); The reason is that we want our INPUT command to fill our variable "a". In C, we must call input() and say to it where our variable is, in order to let it fill the variable. The ampersand "&" takes the address of the variable, and passes it to the function. The declaration of input() says "int *a", which states that "a" is not an integer, but a pointer to an integer, ie, the parameter says where to find the value, not the value itself. GAMBAS IMPLEMENTATION OF POINTERS Gambas has the datatype Pointer, and a set of operations suitable for it. To use a pointer, a normal declaration is required like any other variable. Then, a value must be assigned to it. When using a normal variable, often you can assign a literal, for example you can write "a=3". With pointers, this is not advisable. A pointer gives access to any cell location in memory, but you should know in advance what location you are interested in, and that location must be the correct one for the intended purpose, otherwise Gambas or the operating system will get angry. This is much the same as saying that you can not write "MainForm = 3". You can write "MainForm = NEW Form()", or "MainForm = AnotherExistentForm", or "MainForm = NULL". So, a direct assignment to a pointer will always be to NULL, to another pointer, or to a call to some function returning a pointer. Just as a class instance variable like MainForm. Sometimes an external function returns a pointer, and this pointer will be required in order to invoke subsequent calls to the external library. This case is much like creating a Form, and using its reference to operate on the form itself. In this case, the data behind (pointed by) the pointer is said to be "opaque": we can not see through something opaque, so we don't know, and we don't want to know. This is the simplest case; an example about this is the LDAP library. The first thing to do to interact with LDAP is to open a connection to a server. All the subsequent operations will be made on the connection created by a specific call. Things go like this: LIBRARY "libldap:2" PRIVATE EXTERN ldap_init(host AS String, port AS Integer) AS Pointer PRIVATE ldapconn as Pointer ... ldapconn = ldap_init(host, 389) IF ldapconn = NULL THEN error.Raise("Can not connect to the ldap server") As already seen, a LIBRARY is specified. Then, an EXTERN function is declared; this function is the one which must be called in order to do anything with ldap. The last two lines are the ones that, when executed, will open the connection and store its handle, or instance, for this connection. In this specific case, ldap_init() returns NULL if something goes wrong, so we can test for NULL to raise an error. Once obtained a handle to the connection, this handle must be specified on every subsequent call to the ldap library. For example, to delete an entry in the database, the following must be used: PRIVATE EXTERN ldap_delete_s(ldconn AS Pointer, dn AS String) AS Integer ... PUBLIC SUB remove(dn AS String) AS Integer DIM res AS Integer res = ldap_delete_s(ldapconn, dn) Unfortunately, things are not always so simple. One of the reasons C uses a pointer, is to let the subroutine write some data in the location indicated by the calling parameters. Remaining in the initialization of a library, ALSA for example is different. To initiate a dialog with the alsa sequencer, a handle for the sequencer is needed. The C declaration for this function is: int snd_seq_open(snd_seq_t **seqp, const char * name, Int streams, Int mode); Hep! what is this "snd_seq_t **seqp"? We know that the asterisk is used to indicate a pointer - so what could mean a double asterisk? It's easy: a pointer to a pointer. This function snd_seq_open() uses the pointer notation to fill a value; this value is a pointer itself. Differently from the case of LDAP, where the function ldap_init() returns only one value, here this function returns two values. The return result of the function is an error code - all the ALSA functions use this scheme. A return result of zero means success. So to return more than a value, the function can only write some data to some location we specify, by using a pointer. The value it writes has type pointer, so the notation "double pointer" is used. So far so good. But can we translate this to Gambas? Yes and no. We need a pointer, and this is not a problem. Then we must take the address of this pointer, in order to obtain "a pointer to a pointer". Gambas3 can do that, Gambas2 can not. Let see the simpler way, only available in Gambas3. The VarPtr() function returns the address of a variable or, in other words, a pointer to that variable - and its name says so: VAR-PTR, "variable pointer". In gambas3 we would write: PRIVATE EXTERN snd_seq_open(Pseq AS Pointer, name AS String, streams AS Integer , mode AS Integer) AS Integer ... PRIVATE AlsaHandler as Pointer ... err = snd_seq_open(VarPtr(AlsaHandler), "default", 0, 0) The EXTERN declaration says that snd_seq_open() expects a pointer, which is true: snd_seq_open() expects a pointer to a pointer, which is anyway a pointer. So we declare a variable Alsahandler as pointer, and pass its address using VarPtr() which returns a pointer to the variable. In Gambas 2 this is not possible - we don't have VarPtr(). We must anyway declare a variable to hold the handle, like before, but then we can not get its address, or a pointer to it. We will attack the problem from another side. We need to find a location in memory to pass to alsa and, after that, go to peek in that location. In Gambas 2 the only way is the Alloc() function. By using Alloc(), we reserve a piece of memory somewhere, and obtain its address. This address is what we need to pass to snd_seq_open(): a pointer contains an address. Well, can we start to write something? Yes: ' int snd_seq_open(snd_seq_t **seqp, const char * name, Int streams, Int mode); PRIVATE EXTERN snd_seq_open(Pseq AS Pointer, name AS String, streams AS Integer , mode AS Integer) AS Integereger PRIVATE AlsaHandler as Pointer ... DIM err AS Integer DIM ret AS Pointer ret = Alloc(4) ' 4 is the size of a pointer in 32-bit systems; 8 for 64-bit sy stems err = snd_seq_open(ret, "default", 0, 0) When we want to open the connection and obtain a handler, we reserve some memory and pass its address, in order to have snd_seq_open() write useful data there. But then, how can we read that location to retrieve the handler? Here come the functionality of pointers in gambas. Pointers can work like streams - you can read from them and write to them. Actually, the memory of the computer is a file of memory cells, right? We can read a value from a pointer with: READ #ret, AlsaHandler At this point, we succeeded. It's a little like an Odissey, but it is worth! We only must release the memory we reserved with Alloc(), so the Odissey is not yet over. That memory has been used in a temporary way, and we could neglect it, but if this operation was made many many times in a program, the program continues to eat memory. Normally Gambas has automatic memory management, but in this case it cannot help because it doesn't know what we are doing with the memory, so we are responsible to free the memory when we are done with it: Free(ret) There are other reasons to use a pointer. Take the declaration of getloadavg(), a nice function that tells us how much our CPU has been busy in the last minute: int getloadavg(double loadavg[], int nelem); This nice C language can even pass arrays to functions? Yes. And try to guess how it does it? Pointers again... In this case, the array passed to the function will be filled with one or more values, each signifying a different kind of load average; each value will be put in consecutive locations in the array. But C is not smart enough to know how big an array is, so the function can not know how many values to write. We have to tell the function, through the "nelem" parameter. To make it short, the correct declaration for this situation is this: EXTERN getloadavg(ploadavg AS Pointer, nelem AS Integer) AS Intege r We need to pass a pointer, because the function getloadavg expects a pointer, even if this could not be obvious by looking at its declaration. The pointer must point to free ram, because the function will fill the memory pointed to by this pointer. Then, we will read the values and, lastly, we will fre the memory. Ax example usage is: PUBLIC SUB get_load() AS Float DIM p AS Pointer DIM r AS Float p = Alloc(8) IF getloadavg(p, 1) <> 1 THEN Free(p) RETURN -1 ' error ENDIF READ #p, r Free(p) RETURN r END The subroutine is straightforward: we allocate 8 bytes because a gambas float is 8 bytes long. Then we call the getloadavg(), which will fill these 8 bytes. Whether the operation succeeds or not, we must free the allocated memory. But, If the operation succeeded, first we must read the memory. This is why we have two "free(p)" in the subroutine. A more elegant way could be to use a FINALLY clause, but this way we are more close to the C spirit... getloadavg() returns the number of values read. Asking for only one value, it is legitimate to interpret a return result different from one as an error. If we asked for three, and only obtained two, we would have had a strange situation - something in between from a correct result and a failure. This and other funny things can be seen when trying to use some historical interfaces. For example, in some version of Unix there is not a clear method to read a file name. The function returns the number of character written, but no indication that the name is shorter than that. So you are only sure to have read the full name when you passed a buffer longer than the function result. But you have the function result *after* the call, not before! The typical usage is to take an arbitrary value, say 256, and do the first try. If it fails, you add another 256 bytes, and try again. And so on... Back to our getloadavg(), anyway. We used Alloc(8) because a gambas float is 8 bytes long. And we used a gambas float in order to interface with a C double. But where is stated that a C double is 8 bytes long? In fact, there are out there machines where a double is 10 bytes. This is a serious issue, because the above subroutine will not work. We couuld allocate more memory, perhaps 64 bytes instead of 8: I am pretty sure that no computer exists wich use more than 64 bytes for a floating point number. But anyway, trying to read a 8-bytes value out of a 64-bytes value would yeld a nonsense. Perhaps is better to let a program crash, instead of giving the impression that it works. One question could arise... how can a C program work on so many different architectures? The answer is the following: because a new, perhaps different architecture, must have an omogeneous set of kernel, include files and compiler. In a real C program you will never see a statement like "alloc(8)", but instead something like "alloc(sizeof(double))". The compiler knows the size of a double, and the keyword "sizeof" puts the knowledge of the compiler into the source program. More on pointers Some better explanation is needed, at this point. The instruction READ #ret,... reads something from the location pointed to by the pointer "ret". It is important to stress once again that this kind of things must be designed carefully. Working badly with pointers is one of the most common cause of failure of C programs and, when using pointers, Gambas can do no differently. In this case is easy, because we made our job in a few lines in a row. The semantics of the READ instruction in pointers resembles the one of STREAM, but with an important difference: while the stream is advanced automatically after a read or a write, the same operation on pointer does not. If our memory contained two variables to be read, one after the other, we had to advance the pointer by ourselves: READ #mypointer, var1_4byte mypointer += 4 READ #mypointer, var2_4byte As you can see, it is possible to treat a pointer like an integer. Using this mechanism, one can walk forward and back in memory to emulate what in C are called "struct". A "C struct" is a group of heterogeneous variables put side by side, which then can be treated like a single variable. Its closest counterpart in Gambas is, again, a class. Structures are often referenced by a pointer, especially when they are to be passed to a function. We will se later an alternative method to implement this in gambas, but now we are talking about pointers, so we will finish this topic. The C language has also "unions", which are an unknown thing to Gambas, and therefore they must be emulated using pointers (not completely true). Unions are composed of two or more variables that share the same memory: writing to one variable modifies implicitly the others too: they are overlapped. The reason for this is to describe in a unique type different layouts. By combining struct and union, complex configurations can be generated, and this layouts are difficult not only to manage, but even to understand. To give an example, we will talk again about the ALSA sequencer. The sequencer works with events (mostly notes to be played) that have a time stamp to indicate "when" these events are to be played or carried out. This time stamp can be expressed in ticks, which is the traditional way related to the metronome. Ticks are normal integers. But ALSA goes further, and permits to use real-time time stamps, a much more precise indication, useful to synchronize music with other things (video, for example). This measurement is more precise, therefore it needs more memory to hold the bigger precision (two integers). So there are events having time specified with 4 bytes (an integer), and events having time specified with 8 bytes. They could have used simply two fields, respectively of 4 and 8 bytes, one after the other. But by using a union, they saved 4 bytes. The real memory reserved for time stamp is 8 byte, big enough to hold either of the two values, but at a logic level these two values are mutually exclusive. All this is handled automatically by the C compiler. When playing with unions in Gambas, we must do all this by ourself. A Gambas drum machine A concrete example about all we have seen until now is the ALSA library: a simple, very basic drum machine will be implemented in Gambas. First of all, what is a drum machine? It is a machine which emulates the combination of a drum player and a drum set. Many musicians use it, especially those who produce music all by themself. In the Gambas world, this is accomplished by using ALSA. ALSA is the Advanced Linux Sound Architecture, and its aim is to offer a complete set of functions to produce sounds and, hence, music. From the point of view of a computer, generic sound and music are two different things. If you play an MP3 file, ALSA will move the speakers as directed by the MP3 data, without knowing or analyzing anything. We are interested in another kind of interface - the sequencer interface. A sequencer copes with "events", which are "played" at the right times, using suitable parameters (or properties) for the event. If we think at a piano player, we can see that he presses his keys, one or more together, at different moments. Simply, every keypress it's an event. The three most important things when pressing a key on a piano are: 1) when; 2) which key; 3) how strong. If you want to play two notes at the same time, you create two events having the same "timestamp". If you want to play a chord, you create three events having the same time, three different notes, and (probably) the same strongness. Then, you feed these events to the sequencer, and it will send them to something else which will produce the sounds. The sequencer does not care about producing sound: this can be produced by some software, or be outputted by a MIDI interface to some external musical instrument. If, instead of a piano, you say "I want trumpets", the three notes will be played by three trumpets. This interface does not specify "how long the notes play": they will sound until another event will say to stop. So a single note is actually done with two events: a NOTE-ON and a NOTE-OFF. In the case of drums, a note identifies a different piece of percussion: bass drum, snare drum, cymbals, maracas, bells, even whistles and much more. Music and computers have much in common. For example, a typical musical measure is divided in 4 quarters. Is the number four uncommon in computers? Keys on piano are numbered, and the strongness ("velocity") of a keypress can be expressed by a number, as well as the duration of a note. There are other values involved, for example the force a flute player uses to blow in his instrument (after the note has been started), but we will not go so deep. Only let me say that a good sequencer, combined with good hardware, can simulate surprisingly well an entire orchestra. The simple drum machine has a grid on the screen, and every cell of the grid represents a note: its row number specifies the note to be played (on a drum machine, different notes correspond to different pieces, or instruments). The column of a cell represents the time when the note will be played. The grid contains two measures which are played over and over - this is enough to construct a normal rythm. Every measure is divided in 4 quarters, and every quarter is divided further in four 16th's. The top row is a visual ruler, and the leftmost column is used to hear an instrument. Clicking in a cell toggles an "o" marker; to play the pattern click the button "Play grid". Other buttons produce some other sound, just to show simpler things like chords, legato's, arpeggio. To have the program produce sounds, the correct client/device and port (alsa terminology) must be written in the first two lines of FMain.class, and depends on the hardware installed. Issuing an "aconnect -ol" in a terminal shows the suitable devices. If a software synthetizer is present, like Timidity, probably it will show as "client 128". The MIDI out device could be number 16. The port number can probably be always 0. Another way to find out the correct numbers is to use an already working sequencer or MIDI player, like Kmidi, and peek at its midi configuration. The main reason to analyze this program is to look at a complete interface with an external library. Most of the issues have been presented already, but an important part not yet covered is how to cope with C structures using pointers. Instead of using pointers, an alternative way is to use declare variables in a class, and then pass an instance of that class to an external function; this is not covered here: the method would be better and clearer, but the pointers are more versatile. A yet better approach is possible in gambas3, which has native structures. Because the program is very alsa-specific, we will skip everything but the "event structure". Once all the things required by alsa are done (opening alsa, creating queues, ports, starting them and so on), only remains to construct events and send them to alsa, which will play them at the correct time. An event is defined by alsa like this: snd_seq_event_type_t type unsigned char flags unsigned char tag unsigned char queue snd_seq_timestamp_t time snd_seq_addr_t source snd_seq_addr_t dest union { snd_seq_ev_note_t note snd_seq_ev_ctrl_t control snd_seq_ev_raw8_t raw8 snd_seq_ev_raw32_t raw32 snd_seq_ev_ext_t ext snd_seq_ev_queue_control_t queue snd_seq_timestamp_t time snd_seq_addr_t addr snd_seq_connect_t connect snd_seq_result_t result } The first lines, before "union", are common to every kind of events; in fact, they contain the event "type", some "flags", a "tag", the "queue" where to enqueue the event, the "source" (who created the event?) and the "dest" (to whom send this event?). Let's look at the firt line: "snd_seq_event_type_t type". The field is named "type", and its type is "snd_seq_event_type_t type". So we must inspect the documentation to find out how this type is made. We find: typedef unsigned char snd_seq_event_type_t The line above says that "snd_seq_event_type_t" is an alias for "unsigned char". An unsigned char is a byte. The next three fields in the struct are flags tag and queue, all of type unsigned char, hence byte. Then the timestamp "time" is declared as "snd_seq_timestamp_t"; searching again for declaration, we find that it is a union containing either a midi tick (an unsigned int) or a struct which is composed by two unsigned int. The net result is that the length of this field is 2 unsigned ints, or 8 bytes on 32-bit systems. The first part of an event is composed, by our point of view, of the following fields: type_of_event a single byte flags a single byte tag a single byte queue a single byte timestamp, composed of: tick (int) or tv_sec an integer tv_nsec an integer If we want to fill the field "tick", we must point a pointer to the beginning of the event memory, then advance the pointer by 4 bytes, then write to the pointer the intended value (an integer). The CAlsa class allocates memory for just an event: PUBLIC SUB alsa_open(myname AS String) ... ... ' alloc an event to work with. It is global to avoid alloc/dealloc burden ev = Alloc(SIZE_OF_SEQEV) and then manipulates this memory over and over before passing the event to alsa. The subroutine prepareev() clears the event and fills the common part. Here is its declaration: PRIVATE SUB prepareev(type AS Byte, flags AS Byte, ts AS Integer) AS Pointer DIM p AS Pointer DIM i AS Integer The parameters of the function reflect what we are interested in - for example, we are not interested in the "tag" field, so we don't pass a value for it. The first step is to clear the event, to make sure that no unwanted data is there from before: ' clear the event p = ev FOR i = 1 TO SIZE_OF_SEQEV WRITE #p, 0, 1 INC p NEXT The pointer "p" is pointed to the beginning of the event with "p = ev". With a for-next a stream of zeroes is written out. The instruction "WRITE #p, 0, 1" writes in the memory pointed by #p; it writes the value 0, using 1 byte. We must specify "1" (ie 1 byte), because the second parameter (0) is an integer constant, so gambas thinks it should write 4 bytes (or 8) - we force it to write a single byte. If instead of using a constant ("0"), we used a variable of type byte, gambas would have know the size of the variable (1 byte), and we could have avoided to specify the size. But beware! This works with variables, but not with constants (a gambas 2 bug, I suppose). A better algorithm to clear the event would be to write 4 bytes at a time, and reduce the loop to 1/4. A still better way would be to simply rewrite fields we are interested in, and clear only the fields we know that are dirty. After clearing the event, we start to fill the relevant fields. Again, we point our pointer "p" to the correct place (we moved it, remember?), write a value, and move the pointer afterward: p = ev WRITE #p, type p += 1 ' now p points to the flag field Notice that the "WRITE #p" has a slightly different syntax. This time a variable is written, so there is no need to tell gambas how many bytes to write. We want to write a single byte, and the variable "type" is 1 byte long. The rest of the routine is a repetition of what we have already seen. At the point of writing the timestamp, which is a C union, there is the following code: WRITE #p, ts ' timestamp p += 4 This single instruction writes the first of the two integers of "snd_seq_timestamp_t time". Then: ts = 0 WRITE #p, ts ' 2^ part (realtime event) p += 4 Well, these three lines are not needed. We cleared all the memory before, so there is no need to set any field to zero. But we should anyway move the pointer. The two previous blocks of code could be as follows: WRITE #p, ts ' timestamp p += 8 The subroutine prepareev() is called by noteon() and noteoff(), which then continue to fill the event with own data. The noteon() subroutine is this: PUBLIC SUB noteon(ts AS Integer, channel AS Byte, note AS Byte, velocity AS Byt e) DIM p AS Pointer DIM err AS Integer p = prepareev(SND_SEQ_EVENT_NOTEON, 0, ts) WRITE #p, channel INC p WRITE #p, note INC p WRITE #p, velocity err = snd_seq_event_output_buffer(handle, ev) The subroutine accepts a timestamp "ts", which says -when- to play the note, and refers to the time when the queue was started. A timestamp of zero, or anyway a value less than the current time of the queue, is played immediately. If the timestamp is greater than the current queue time, then the event will be played in the future, when the queue will reach the correct time. But alsa can also use relative timestamps, setting a flag in the event. The gambas CAlsa class uses this possibility embedding it in the timestamp directly. If the ts parameter to the prepareev() is set to a negative value, then the routine inverts its sign and sets the relative flag. In the main program, the routine btArpeggio_Click() produces three notes in succession by using this possibility: PUBLIC SUB btArpeggio_Click() alsa.noteon(0, 0, 60, 100) alsa.noteoff(-100, 0, 60, 100) alsa.noteon(-100, 0, 64, 100) alsa.noteoff(-200, 0, 64, 100) alsa.noteon(-200, 0, 67, 100) alsa.noteoff(-300, 0, 67, 100) alsa.flush END To subroutine starts the first note at time 0, which means "now". After 100 ticks, the note is shut off, and a new one is started (timestamp=-100 means "100 ticks after 0 -- 100 ticks after now"). And so on for the next notes. Given that playing notes is the most common task, and that to play a note one must create a note-on and a note-off, the CAlsa class implements a routine to do that with a single call. The following routine: ' 32 notes having their duration less than their spacing ' "staccato": every note terminates well before the next begins PUBLIC SUB btStaccato_Click() DIM i AS Integer FOR i = 1 TO 32 ' relative timestamp=10, 20, 30... successive steps by 10 ' but the notes have duration=5, not 10 alsa.playnote(-10 * i, 0, 60 + i, 100, 5) NEXT alsa.flush END uses a single call to playnote(), which in turn generates internally two events. Lastly, to be precise, here is an explanation of the drum machine algorithm. The whole thing is to produce a stream of events, which will be played later. We must prepare a bunch of events in advance, so the hardware has data to work on. But a drum machine can be kept on for a long time, and we can not buffer all the needed events - we must supply a certain number of events ahead of time, not too much and not too little. The internal "pointer" of the drum machine always is a musical measure ahead of the sound we are hearing. We can not predict reliably "when" new data will be needed, because the sequencer consumes the events basing itself on a timer that can be different from our. Without a feedback from the sequencer, it is nearly impossible to keep in sync. The problem is even more difficult if we want to have a visual feedback on what the sequencer is playing in a given moment. This is solved by adding, in the event stream, some event whose purpose is not to make sounds, but to come back to us: an echo. The sequencer receives this added events, and sends them back to us at the correct moment. When we see this echoes, we know at which point the sequencer is. The gambas drum machine sends an echo for every quarter, and uses this information, when it comes back, to give a visual feedback. These echo events can contain some user data - that datum is used to distinguish them; in the program, this can reveal a start of a measure, and in that condition a new measure is loaded (buffered in advance) to the sequencer. The problem, in this program, is that the normal alsa interface does not provide a callback to signal when an event is ready to be read (even if it did, gambas2 could not use it) . This is simulated by the CAlsa class, which raises a Gambas event when an alsa event of type "echo" has been read, but the CAlsa class itself uses polling to interrogate alsa. The frequency of this polling can be varied using the slider "poll freq" in the main program. Setting this frequency to low values should show an imprecise visual feedback of the drum machine, but the precision of the music should be unaffected. _________________________________________________________________ No backlinks to this page. References Visible links 1. file://localhost/tmp/index.html Hidden links: 2. file://localhost/tmp/.html 3. file://localhost/tmp/.html -------------- next part -------------- Home root 2010-08-23 %!postproc(html): ~~(.*?)~~ \1 = Home = = Home = Created sabato 10 luglio 2010 How to interface Gambas to external libraries == INTRODUCTION == There are lots of shared libraries available in a Linux system, capable of doing a lot of useful things, and many of those libraries can be used from Gambas using some of its features. The first step to do is to find a suitable library to use for a given purpose; not all the libraries can be used, but the vast majority can. The prerequisite is that the library is written in plain C. Most libraries are written in C, while others are written in C++ and, perhaps, still other languages. This document will focus only about C libraries. Once the intended library is found, its general logic must be understood in order to determine what is needed, and how this new stuff will be used by the final program. The full documentation of the library, and possibly some example, should be readed carefully. Libraries are not programs, and hence their philosophy is quite different. A program tends to contain only the subroutines required to do its job, while a library is what the name implies: a collection of subroutines, to be used many times, by many different programs. It is not uncommon to find, inside libraries, two or more subroutines which do the same thing, in a slightly different way. Libraries sometimes are written keeping in mind that they will be used by different languages, not only C: python, ruby, ocaml, many others, Gambas included. Libraries tend to encapsulate the details of a task inside a "handle", in a way similar to a Gambas object; but, they don't have properties and methods - everything is carried out by calling functions which these handles are passed to. If you think at a Gambas class with three properties and four methods, an external library implementing the same thing will have at least seven (three+four) subroutines, and probably a couple more to create and destroy the object. Other than this, there is not a big difference from setting a property and calling a function, the latter is simply a bit longer to write. To search for what we need, we must be prepared to read a lot of documentation, too often badly written (hey, apropos, how well do we document our software?). == THE EXTERN DECLARATION == Extern declaration is simple. It is like a normal Gambas subroutine declaration, but preceded by "EXTERN". The EXTERN keyword says to gambas that the body of the procedure is not defined by the gambas program we are writing, but somewhere else (an external library). We must also specify which library to use: this is done by the clause "IN libraryXXX". Alternatively, you can use a separate LIBRARY statement: all the subsequent extern declarations will refer to this statement. Either "IN library" or "LIBRARY xxx" can specify a version number after a colon, and this is recommended. Let's see an example, choosen because of its simplicity: ``` LIBRARY "libc:6" EXTERN getgid() AS Integer ``` These two lines say that a function named "getgid" exists in the library "libc" version 6. This function takes no parameters, and returns an integer (the group ID). The same thing can be written like this: ``` EXTERN getgid() AS Integer IN "libc:6" ``` Another example, slightly more complicated. This time we have parameters, and the last thing to say about the formal declaration: ``` ' int kill(pid_t pid, int sig); EXTERN killme(pid AS Integer, sig AS Integer) AS Integer IN "libc:6" EXEC "kill" ``` The first line (the comment) shows the original declaration, and the second line the gambas one. We can note a number of things. First, what does the original declaration mean? It means "a function called kill returns an int, and it accepts two parameters. The first is named pid and its type is pid_t; the second is named sig and its type is int". Contrary to Gambas, the C language puts the type of a variable before the variable instead of after. Second, what in Gambas is called "Integer", in C is called "int". Third, what is "pid_t"? It's a type; we can understand it because it is written in a place where a type specifier is expected, and because ends with "_t" (underscore t). Third, a new clause EXEC "kill" is used in the Gambas declaration. This is necessary because we want to use a function named kill, but KILL is a name already used by Gambas. So, in Gambas, we must name the function differently, but anyway we must indicate its true name inside the library. The declaration says "I declare an external function named killme, but its real name is kill". I chose the name killme because in the attached gambas example this function is used to kill the running program. To be sincere I noticed that, even without renaming the function from kill to killme, the program was working the same. May be that this has something to do with case sensitivity - C is sensitive, and Gambas not, so there is still a difference between kill (lowercase) and KILL (uppercase). Anyway, when there is a possible name conflict, it is best to use this renaming technique. == WARNING --- END OF THE EASY PART == //(just joking)// At this point, several things must be noted. Most of the suitable libraries are written in C, which is a different language than Gambas. We will need to know at least a little of C declarations, in order to translate them to gambas. Referring to the last example, one could ask why I translated the pid_t type to integer. The simple and correct answer is "because on my system the pid_t type is actually an integer". This answer is really correct, but must be explained better, talking about agrumes (?). We can think about lemons and oranges, which both are agrumes, and are very similar: they weight more or less the same, and often can be interchanged; you can eat them directly, or squeeze them to drink their juice, but it is unlikely that you will put orange juice on your fried fish. In C, this is expressed by the fact that it is unlikely that you want to use the kill() function passing it an arbitrary integer. Surely, you will pass a process identifier (PID), which actually is an integer, but it is indicated more precisely as pid_t. In my motivation, I also said "on my system the pid_t type...". Yes, on my system - on most system, the type pid_t is an integer, but this could be different. The final answer can be found by typing these two commands in a terminal: ``` grep -r pid_t /usr/include/* |grep "#define" grep -r pid_t /usr/include/* |grep typedef ``` which will show the involuted way types are managed in C. This argument is way too complicated to go further; giving that Gambas runs on Linux, and presumably on desktop systems, we can consider that all the parameters passed to a function, and returned by it, will be either integer, or pointers - which are integer too, or strings - which are pointers that are integers. There can be also floating point numbers - float and double. The following table lists some of the types you can encounter in a C declaration, and the suitable type to be used in gambas: ``` C type Gambas type int -> integer long -> long float -> single double -> float xxxx* -> pointer (the asterisk means exactly "pointer") char* -> pointer - but see later other types -> integer or pointer (depends on the declaration); see later ``` We will start to briefly introduce pointers, which are little used in Gambas. A pointer is an integer, but used very differently. The thing that more closely resembles a pointer in Gambas is a class instance. When you create, say, a Form in Gambas, a lot of data is stored somewhere in memory. That memory will hold all the specific settings of the form: its caption, its color, the list of all its children, and so on. The address of that block of memory is returned to your program, and stored into the variable which refers to the just created form: ``` MainForm = NEW Form() ``` That variable MainForm[ .t2t]is really a pointer: in only 4 (or 8) bytes it tracks a lot of data, stored somewhere in memory at a specific location (address). The memory is a long sequence of cells (bytes), each identified by a progressive number. A pointer contains the identifying number of a cell of memory (its address). In C, pointers are used for two reasons: the first is that passing only an address (a pointer contains an address), is much quicker than passing a lot of data; this is the same reason why Gambas instance variables like MainForm[ .t2t]are similar to pointers. The second reason is when the called function should modify the variable we pass. For example, if we in Gambas wrote: ``` INPUT a ' where a is an integer ``` in C we would write: ``` void input(int *a); ... input(&a); ``` The reason is that we want our INPUT command to fill our variable "a". In C, we must call input() and say to it where our variable is, in order to let it fill the variable. The ampersand "&" takes the address of the variable, and passes it to the function. The declaration of input() says "int *a", which states that "a" is not an integer, but a pointer to an integer, ie, the parameter says where to find the value, not the value itself. == GAMBAS IMPLEMENTATION OF POINTERS == Gambas has the datatype Pointer, and a set of operations suitable for it. To use a pointer, a normal declaration is required like any other variable. Then, a value must be assigned to it. When using a normal variable, often you can assign a literal, for example you can write "a=3". With pointers, this is not advisable. A pointer gives access to any cell location in memory, but you should know in advance what location you are interested in, and that location must be the correct one for the intended purpose, otherwise Gambas or the operating system will get angry. This is much the same as saying that you can not write "MainForm = 3". You can write "MainForm = NEW Form()", or "MainForm = AnotherExistentForm", or "MainForm = NULL". So, a direct assignment to a pointer will always be to NULL, to another pointer, or to a call to some function returning a pointer. Just as a class instance variable like MainForm. Sometimes an external function returns a pointer, and this pointer will be required in order to invoke subsequent calls to the external library. This case is much like creating a Form, and using its reference to operate on the form itself. In this case, the data behind (pointed by) the pointer is said to be "opaque": we can not see through something opaque, so we don't know, and we don't want to know. This is the simplest case; an example about this is the LDAP library. The first thing to do to interact with LDAP is to open a connection to a server. All the subsequent operations will be made on the connection created by a specific call. Things go like this: ``` LIBRARY "libldap:2" PRIVATE EXTERN ldap_init(host AS String, port AS Integer) AS Pointer PRIVATE ldapconn as Pointer ... ldapconn = ldap_init(host, 389) IF ldapconn = NULL THEN error.Raise("Can not connect to the ldap server") ``` As already seen, a LIBRARY is specified. Then, an EXTERN function is declared; this function is the one which must be called in order to do anything with ldap. The last two lines are the ones that, when executed, will open the connection and store its handle, or instance, for this connection. In this specific case, ldap_init() returns NULL if something goes wrong, so we can test for NULL to raise an error. Once obtained a handle to the connection, this handle must be specified on every subsequent call to the ldap library. For example, to delete an entry in the database, the following must be used: ``` PRIVATE EXTERN ldap_delete_s(ldconn AS Pointer, dn AS String) AS Integer ... PUBLIC SUB remove(dn AS String) AS Integer DIM res AS Integer ``` ``` res = ldap_delete_s(ldapconn, dn) ``` Unfortunately, things are not always so simple. One of the reasons C uses a pointer, is to let the subroutine write some data in the location indicated by the calling parameters. Remaining in the initialization of a library, ALSA for example is different. To initiate a dialog with the alsa sequencer, a handle for the sequencer is needed. The C declaration for this function is: ``` int snd_seq_open(snd_seq_t **seqp, const char * name, Int streams, Int mode); ``` Hep! what is this "snd_seq_t **seqp"? We know that the asterisk is used to indicate a pointer - so what could mean a double asterisk? It's easy: a pointer to a pointer. This function snd_seq_open() uses the pointer notation to fill a value; this value is a pointer itself. Differently from the case of LDAP, where the function ldap_init() returns only one value, here this function returns two values. The return result of the function is an error code - all the ALSA functions use this scheme. A return result of zero means success. So to return more than a value, the function can only write some data to some location we specify, by using a pointer. The value it writes has type pointer, so the notation "double pointer" is used. So far so good. But can we translate this to Gambas? Yes and no. We need a pointer, and this is not a problem. Then we must take the address of this pointer, in order to obtain "a pointer to a pointer". Gambas3 can do that, Gambas2 can not. Let see the simpler way, only available in Gambas3. The VarPtr() function returns the address of a variable or, in other words, a pointer to that variable - and its name says so: VAR-PTR, "variable pointer". In gambas3 we would write: ``` PRIVATE EXTERN snd_seq_open(Pseq AS Pointer, name AS String, streams AS Integer, mode AS Integer) AS Integer ... PRIVATE AlsaHandler as Pointer ... err = snd_seq_open(VarPtr(AlsaHandler), "default", 0, 0) ``` The EXTERN declaration says that snd_seq_open() expects a pointer, which is true: snd_seq_open() expects a pointer to a pointer, which is anyway a pointer. So we declare a variable Alsahandler as pointer, and pass its address using VarPtr() which returns a pointer to the variable. In Gambas 2 this is not possible - we don't have VarPtr(). We must anyway declare a variable to hold the handle, like before, but then we can not get its address, or a pointer to it. We will attack the problem from another side. We need to find a location in memory to pass to alsa and, after that, go to peek in that location. In Gambas 2 the only way is the Alloc() function. By using Alloc(), we reserve a piece of memory somewhere, and obtain its address. This address is what we need to pass to snd_seq_open(): a pointer contains an address. Well, can we start to write something? Yes: ``` ' int snd_seq_open(snd_seq_t **seqp, const char * name, Int streams, Int mode); PRIVATE EXTERN snd_seq_open(Pseq AS Pointer, name AS String, streams AS Integer, mode AS Integer) AS Integereger PRIVATE AlsaHandler as Pointer ... DIM err AS Integer DIM ret AS Pointer ``` ``` ret = Alloc(4) ' 4 is the size of a pointer in 32-bit systems; 8 for 64-bit systems err = snd_seq_open(ret, "default", 0, 0) ``` When we want to open the connection and obtain a handler, we reserve some memory and pass its address, in order to have snd_seq_open() write useful data there. But then, how can we read that location to retrieve the handler? Here come the functionality of pointers in gambas. Pointers can work like streams - you can read from them and write to them. Actually, the memory of the computer is a file of memory cells, right? We can read a value from a pointer with: ``` READ #ret, AlsaHandler ``` At this point, we succeeded. It's a little like an Odissey, but it is worth! We only must release the memory we reserved with Alloc(), so the Odissey is not yet over. That memory has been used in a temporary way, and we could neglect it, but if this operation was made many many times in a program, the program continues to eat memory. Normally Gambas has automatic memory management, but in this case it cannot help because it doesn't know what we are doing with the memory, so we are responsible to free the memory when we are done with it: ``` Free(ret) ``` There are other reasons to use a pointer. Take the declaration of getloadavg(), a nice function that tells us how much our CPU has been busy in the last minute: ``` int getloadavg(double loadavg[], int nelem); ``` This nice C language can even pass arrays to functions? Yes. And try to guess how it does it? Pointers again... In this case, the array passed to the function will be filled with one or more values, each signifying a different kind of load average; each value will be put in consecutive locations in the array. But C is not smart enough to know how big an array is, so the function can not know how many values to write. We have to tell the function, through the "nelem" parameter. To make it short, the correct declaration for this situation is this: ``` EXTERN getloadavg(ploadavg AS Pointer, nelem AS Integer) AS Intege r ``` We need to pass a pointer, because the function getloadavg expects a pointer, even if this could not be obvious by looking at its declaration. The pointer must point to free ram, because the function will fill the memory pointed to by this pointer. Then, we will read the values and, lastly, we will fre the memory. Ax example usage is: ``` PUBLIC SUB get_load() AS Float DIM p AS Pointer DIM r AS Float ``` ``` p = Alloc(8) IF getloadavg(p, 1) <> 1 THEN Free(p) RETURN -1 ' error ENDIF ``` ``` READ #p, r Free(p) RETURN r END ``` The subroutine is straightforward: we allocate 8 bytes because a gambas float is 8 bytes long. Then we call the getloadavg(), which will fill these 8 bytes. Whether the operation succeeds or not, we must free the allocated memory. But, If the operation succeeded, first we must read the memory. This is why we have two "free(p)" in the subroutine. A more elegant way could be to use a FINALLY clause, but this way we are more close to the C spirit... getloadavg() returns the number of values read. Asking for only one value, it is legitimate to interpret a return result different from one as an error. If we asked for three, and only obtained two, we would have had a strange situation - something in between from a correct result and a failure. This and other funny things can be seen when trying to use some historical interfaces. For example, in some version of Unix there is not a clear method to read a file name. The function returns the number of character written, but no indication that the name is shorter than that. So you are only sure to have read the full name when you passed a buffer longer than the function result. But you have the function result *after* the call, not before! The typical usage is to take an arbitrary value, say 256, and do the first try. If it fails, you add another 256 bytes, and try again. And so on... Back to our getloadavg(), anyway. We used Alloc(8) because a gambas float is 8 bytes long. And we used a gambas float in order to interface with a C double. But where is stated that a C double is 8 bytes long? In fact, there are out there machines where a double is 10 bytes. This is a serious issue, because the above subroutine will not work. We couuld allocate more memory, perhaps 64 bytes instead of 8: I am pretty sure that no computer exists wich use more than 64 bytes for a floating point number. But anyway, trying to read a 8-bytes value out of a 64-bytes value would yeld a nonsense. Perhaps is better to let a program crash, instead of giving the impression that it works. One question could arise... how can a C program work on so many different architectures? The answer is the following: because a new, perhaps different architecture, must have an omogeneous set of kernel, include files and compiler. In a real C program you will never see a statement like "alloc(8)", but instead something like "alloc(sizeof(double))". The compiler knows the size of a double, and the keyword "sizeof" puts the knowledge of the compiler into the source program. == More on pointers == Some better explanation is needed, at this point. The instruction READ #ret,... reads something from the location pointed to by the pointer "ret". It is important to stress once again that this kind of things must be designed carefully. Working badly with pointers is one of the most common cause of failure of C programs and, when using pointers, Gambas can do no differently. In this case is easy, because we made our job in a few lines in a row. The semantics of the READ instruction in pointers resembles the one of STREAM, but with an important difference: while the stream is advanced automatically after a read or a write, the same operation on pointer does not. If our memory contained two variables to be read, one after the other, we had to advance the pointer by ourselves: ``` READ #mypointer, var1_4byte mypointer += 4 READ #mypointer, var2_4byte ``` As you can see, it is possible to treat a pointer like an integer. Using this mechanism, one can walk forward and back in memory to emulate what in C are called "struct". A "C struct" is a group of heterogeneous variables put side by side, which then can be treated like a single variable. Its closest counterpart in Gambas is, again, a class. Structures are often referenced by a pointer, especially when they are to be passed to a function. We will se later an alternative method to implement this in gambas, but now we are talking about pointers, so we will finish this topic. The C language has also "unions", which are an unknown thing to Gambas, and therefore they must be emulated using pointers (not completely true). Unions are composed of two or more variables that share the same memory: writing to one variable modifies implicitly the others too: they are overlapped. The reason for this is to describe in a unique type different layouts. By combining struct and union, complex configurations can be generated, and this layouts are difficult not only to manage, but even to understand. To give an example, we will talk again about the ALSA sequencer. The sequencer works with events (mostly notes to be played) that have a time stamp to indicate "when" these events are to be played or carried out. This time stamp can be expressed in ticks, which is the traditional way related to the metronome. Ticks are normal integers. But ALSA goes further, and permits to use real-time time stamps, a much more precise indication, useful to synchronize music with other things (video, for example). This measurement is more precise, therefore it needs more memory to hold the bigger precision (two integers). So there are events having time specified with 4 bytes (an integer), and events having time specified with 8 bytes. They could have used simply two fields, respectively of 4 and 8 bytes, one after the other. But by using a union, they saved 4 bytes. The real memory reserved for time stamp is 8 byte, big enough to hold either of the two values, but at a logic level these two values are mutually exclusive. All this is handled automatically by the C compiler. When playing with unions in Gambas, we must do all this by ourself. == A Gambas drum machine == A concrete example about all we have seen until now is the ALSA library: a simple, very basic drum machine will be implemented in Gambas. First of all, what is a drum machine? It is a machine which emulates the combination of a drum player and a drum set. Many musicians use it, especially those who produce music all by themself. In the Gambas world, this is accomplished by using ALSA. ALSA is the Advanced Linux Sound Architecture, and its aim is to offer a complete set of functions to produce sounds and, hence, music. From the point of view of a computer, generic sound and music are two different things. If you play an MP3 file, ALSA will move the speakers as directed by the MP3 data, without knowing or analyzing anything. We are interested in another kind of interface - the sequencer interface. A sequencer copes with "events", which are "played" at the right times, using suitable parameters (or properties) for the event. If we think at a piano player, we can see that he presses his keys, one or more together, at different moments. Simply, every keypress it's an event. The three most important things when pressing a key on a piano are: 1) when; 2) which key; 3) how strong. If you want to play two notes at the same time, you create two events having the same "timestamp". If you want to play a chord, you create three events having the same time, three different notes, and (probably) the same strongness. Then, you feed these events to the sequencer, and it will send them to something else which will produce the sounds. The sequencer does not care about producing sound: this can be produced by some software, or be outputted by a MIDI interface to some external musical instrument. If, instead of a piano, you say "I want trumpets", the three notes will be played by three trumpets. This interface does not specify "how long the notes play": they will sound until another event will say to stop. So a single note is actually done with two events: a NOTE-ON and a NOTE-OFF. In the case of drums, a note identifies a different piece of percussion: bass drum, snare drum, cymbals, maracas, bells, even whistles and much more. Music and computers have much in common. For example, a typical musical measure is divided in 4 quarters. Is the number four uncommon in computers? Keys on piano are numbered, and the strongness ("velocity") of a keypress can be expressed by a number, as well as the duration of a note. There are other values involved, for example the force a flute player uses to blow in his instrument (after the note has been started), but we will not go so deep. Only let me say that a good sequencer, combined with good hardware, can simulate surprisingly well an entire orchestra. The simple drum machine has a grid on the screen, and every cell of the grid represents a note: its row number specifies the note to be played (on a drum machine, different notes correspond to different pieces, or instruments). The column of a cell represents the time when the note will be played. The grid contains two measures which are played over and over - this is enough to construct a normal rythm. Every measure is divided in 4 quarters, and every quarter is divided further in four 16th's. The top row is a visual ruler, and the leftmost column is used to hear an instrument. Clicking in a cell toggles an "o" marker; to play the pattern click the button "Play grid". Other buttons produce some other sound, just to show simpler things like chords, legato's, arpeggio. To have the program produce sounds, the correct client/device and port (alsa terminology) must be written in the first two lines of FMain.class, and depends on the hardware installed. Issuing an "aconnect -ol" in a terminal shows the suitable devices. If a software synthetizer is present, like Timidity, probably it will show as "client 128". The MIDI out device could be number 16. The port number can probably be always 0. Another way to find out the correct numbers is to use an already working sequencer or MIDI player, like Kmidi, and peek at its midi configuration. The main reason to analyze this program is to look at a complete interface with an external library. Most of the issues have been presented already, but an important part not yet covered is how to cope with C structures using pointers. Instead of using pointers, an alternative way is to use declare variables in a class, and then pass an instance of that class to an external function; this is not covered here: the method would be better and clearer, but the pointers are more versatile. A yet better approach is possible in gambas3, which has native structures. Because the program is very alsa-specific, we will skip everything but the "event structure". Once all the things required by alsa are done (opening alsa, creating queues, ports, starting them and so on), only remains to construct events and send them to alsa, which will play them at the correct time. An event is defined by alsa like this: ``` snd_seq_event_type_t type unsigned char flags unsigned char tag unsigned char queue snd_seq_timestamp_t time snd_seq_addr_t source snd_seq_addr_t dest union { snd_seq_ev_note_t note snd_seq_ev_ctrl_t control snd_seq_ev_raw8_t raw8 snd_seq_ev_raw32_t raw32 snd_seq_ev_ext_t ext snd_seq_ev_queue_control_t queue snd_seq_timestamp_t time snd_seq_addr_t addr snd_seq_connect_t connect snd_seq_result_t result } ``` The first lines, before "union", are common to every kind of events; in fact, they contain the event "type", some "flags", a "tag", the "queue" where to enqueue the event, the "source" (who created the event?) and the "dest" (to whom send this event?). Let's look at the firt line: "snd_seq_event_type_t type". The field is named "type", and its type is "snd_seq_event_type_t type". So we must inspect the documentation to find out how this type is made. We find: ``` typedef unsigned char snd_seq_event_type_t ``` The line above says that "snd_seq_event_type_t" is an alias for "unsigned char". An unsigned char is a byte. The next three fields in the struct are flags tag and queue, all of type unsigned char, hence byte. Then the timestamp "time" is declared as "snd_seq_timestamp_t"; searching again for declaration, we find that it is a union containing either a midi tick (an unsigned int) or a struct which is composed by two unsigned int. The net result is that the length of this field is 2 unsigned ints, or 8 bytes on 32-bit systems. The first part of an event is composed, by our point of view, of the following fields: ``` type_of_event a single byte flags a single byte tag a single byte queue a single byte timestamp, composed of: tick (int) or tv_sec an integer tv_nsec an integer ``` If we want to fill the field "tick", we must point a pointer to the beginning of the event memory, then advance the pointer by 4 bytes, then write to the pointer the intended value (an integer). The CAlsa class allocates memory for just an event: ``` PUBLIC SUB alsa_open(myname AS String) ... ... ' alloc an event to work with. It is global to avoid alloc/dealloc burden ev = Alloc(SIZE_OF_SEQEV) ``` and then manipulates this memory over and over before passing the event to alsa. The subroutine prepareev() clears the event and fills the common part. Here is its declaration: ``` PRIVATE SUB prepareev(type AS Byte, flags AS Byte, ts AS Integer) AS Pointer DIM p AS Pointer DIM i AS Integer ``` The parameters of the function reflect what we are interested in - for example, we are not interested in the "tag" field, so we don't pass a value for it. The first step is to clear the event, to make sure that no unwanted data is there from before: ``` ' clear the event p = ev FOR i = 1 TO SIZE_OF_SEQEV WRITE #p, 0, 1 INC p NEXT ``` The pointer "p" is pointed to the beginning of the event with "p = ev". With a for-next a stream of zeroes is written out. The instruction "WRITE #p, 0, 1" writes in the memory pointed by #p; it writes the value 0, using 1 byte. We must specify "1" (ie 1 byte), because the second parameter (0) is an integer constant, so gambas thinks it should write 4 bytes (or 8) - we force it to write a single byte. If instead of using a constant ("0"), we used a variable of type byte, gambas would have know the size of the variable (1 byte), and we could have avoided to specify the size. But beware! This works with variables, but not with constants (a gambas 2 bug, I suppose). A better algorithm to clear the event would be to write 4 bytes at a time, and reduce the loop to 1/4. A still better way would be to simply rewrite fields we are interested in, and clear only the fields we know that are dirty. After clearing the event, we start to fill the relevant fields. Again, we point our pointer "p" to the correct place (we moved it, remember?), write a value, and move the pointer afterward: ``` p = ev WRITE #p, type p += 1 ' now p points to the flag field ``` Notice that the "WRITE #p" has a slightly different syntax. This time a variable is written, so there is no need to tell gambas how many bytes to write. We want to write a single byte, and the variable "type" is 1 byte long. The rest of the routine is a repetition of what we have already seen. At the point of writing the timestamp, which is a C union, there is the following code: ``` WRITE #p, ts ' timestamp p += 4 ``` This single instruction writes the first of the two integers of "snd_seq_timestamp_t time". Then: ``` ts = 0 WRITE #p, ts ' 2^ part (realtime event) p += 4 ``` Well, these three lines are not needed. We cleared all the memory before, so there is no need to set any field to zero. But we should anyway move the pointer. The two previous blocks of code could be as follows: ``` WRITE #p, ts ' timestamp p += 8 ``` The subroutine prepareev() is called by noteon() and noteoff(), which then continue to fill the event with own data. The noteon() subroutine is this: ``` PUBLIC SUB noteon(ts AS Integer, channel AS Byte, note AS Byte, velocity AS Byte) DIM p AS Pointer DIM err AS Integer ``` ``` p = prepareev(SND_SEQ_EVENT_NOTEON, 0, ts) WRITE #p, channel INC p WRITE #p, note INC p WRITE #p, velocity ``` ``` err = snd_seq_event_output_buffer(handle, ev) ``` The subroutine accepts a timestamp "ts", which says -when- to play the note, and refers to the time when the queue was started. A timestamp of zero, or anyway a value less than the current time of the queue, is played immediately. If the timestamp is greater than the current queue time, then the event will be played in the future, when the queue will reach the correct time. But alsa can also use relative timestamps, setting a flag in the event. The gambas CAlsa class uses this possibility embedding it in the timestamp directly. If the ts parameter to the prepareev() is set to a negative value, then the routine inverts its sign and sets the relative flag. In the main program, the routine btArpeggio_Click() produces three notes in succession by using this possibility: ``` PUBLIC SUB btArpeggio_Click() alsa.noteon(0, 0, 60, 100) ``` ``` alsa.noteoff(-100, 0, 60, 100) alsa.noteon(-100, 0, 64, 100) ``` ``` alsa.noteoff(-200, 0, 64, 100) alsa.noteon(-200, 0, 67, 100) ``` ``` alsa.noteoff(-300, 0, 67, 100) ``` ``` alsa.flush END ``` To subroutine starts the first note at time 0, which means "now". After 100 ticks, the note is shut off, and a new one is started (timestamp=-100 means "100 ticks after 0 -- 100 ticks after now"). And so on for the next notes. Given that playing notes is the most common task, and that to play a note one must create a note-on and a note-off, the CAlsa class implements a routine to do that with a single call. The following routine: ``` ' 32 notes having their duration less than their spacing ' "staccato": every note terminates well before the next begins PUBLIC SUB btStaccato_Click() DIM i AS Integer ``` ``` FOR i = 1 TO 32 ' relative timestamp=10, 20, 30... successive steps by 10 ' but the notes have duration=5, not 10 alsa.playnote(-10 * i, 0, 60 + i, 100, 5) NEXT alsa.flush END ``` uses a single call to playnote(), which in turn generates internally two events. Lastly, to be precise, here is an explanation of the drum machine algorithm. The whole thing is to produce a stream of events, which will be played later. We must prepare a bunch of events in advance, so the hardware has data to work on. But a drum machine can be kept on for a long time, and we can not buffer all the needed events - we must supply a certain number of events ahead of time, not too much and not too little. The internal "pointer" of the drum machine always is a musical measure ahead of the sound we are hearing. We can not predict reliably "when" new data will be needed, because the sequencer consumes the events basing itself on a timer that can be different from our. Without a feedback from the sequencer, it is nearly impossible to keep in sync. The problem is even more difficult if we want to have a visual feedback on what the sequencer is playing in a given moment. This is solved by adding, in the event stream, some event whose purpose is not to make sounds, but to come back to us: an echo. The sequencer receives this added events, and sends them back to us at the correct moment. When we see this echoes, we know at which point the sequencer is. The gambas drum machine sends an echo for every quarter, and uses this information, when it comes back, to give a visual feedback. These echo events can contain some user data - that datum is used to distinguish them; in the program, this can reveal a start of a measure, and in that condition a new measure is loaded (buffered in advance) to the sequencer. The problem, in this program, is that the normal alsa interface does not provide a callback to signal when an event is ready to be read (even if it did, gambas2 could not use it) . This is simulated by the CAlsa class, which raises a Gambas event when an alsa event of type "echo" has been read, but the CAlsa class itself uses polling to interrogate alsa. The frequency of this polling can be varied using the slider "poll freq" in the main program. Setting this frequency to low values should show an imprecise visual feedback of the drum machine, but the precision of the music should be unaffected. From gambas at ...1... Mon Aug 23 21:47:57 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 23 Aug 2010 21:47:57 +0200 Subject: [Gambas-user] Extern howto/tutorial In-Reply-To: <4C72A2F6.2040103@...1909...> References: <4C72A2F6.2040103@...1909...> Message-ID: <201008232147.57248.gambas@...1...> > Hi, > > I finally wrote the tutorial about using external declarations. Great! > > It is a long text and perhaps difficult, but I didn't find any other way > to put it in a simpler form: the problem of interfacing gambas to > external libraries, from the perspective of a gambas user, is not simple. > > I wrote it using zim, a nice wiki editor. I attach what I exported from > the document, in both html and "Txt2Tags" (?) format. This is not HTML, but plain text. If you can make an HTML version of your document, with formatted text, I will be able to add it to the wiki. > > Feel free to modify it as needed, to include it in the wiki, or > whatever. I attach two projects related to the explanation, one short > and simple and one much more complex, but more funny. > > This document regards Gambas2. When it will be corrected/approved, I > will port projects and documentation to Gambas3. > > Now some technical question. > > In the Drum Machine project, after having verified that it works > correctly using pointers for read/write, I tried to create a new class > which should be a gambas representation for an alsa event (which is a C > struct). It does not work, and I don't know how to debug it (well, I > could, using gdb or similar, but I was looking for a more direct way). Give me the C declaration, and your class declaration, and I will be able to see if they correctly match. > My idea was to point a pointer to the instance of the class CEvent, and > then dump a few bytes to see them. But gambas does not let me to assign > a pointer to a class instance ("wanted integer, found object"). > > Moreover, in the gambas 3 documentation there is nothing that makes me > think that "write #pointer, ..." is no more supported. Either gambas3 > supports it (but it does not seems to me), or the documentation is wrong. It is explicitely said that "WRITE #Pointer" is not supported anymore in Gambas 3, in the WRITE documentation page. And so on for the READ instruction. > > Another thing is that if I declare a constant as a byte, and then try to > "write #pointer, my_byte_constant", 4 bytes are written instead of just > one. I had to mention it in the document. Mmm. it could be a bug in Gambas 2. A workaround would be using CByte() explicitely. > > I am really curious to give a try to gambas3 structures, but I want > firstly terminate with gambas2. > > Best regards, > Doriano Blengino The Gambas 3 structures were implemented for the use of extern C structures. Moreover, in Gambas 3, you can now use Gambas functions as C function pointer (as known as "callbacks") almost transparently. Regards, -- Beno?t Minisini From gambas at ...1... Mon Aug 23 21:49:30 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 23 Aug 2010 21:49:30 +0200 Subject: [Gambas-user] Strange MP3 playback In-Reply-To: References: Message-ID: <201008232149.30966.gambas@...1...> > I found that the MP3 files played with Gambas2 doesn't sound correctly: > some of them are slower than normally, and some of them are overmodulated. > Why? Solutions? I guess you are using the gb.sdl.sound component. Can you provide the MP3 that are not played correctly? -- Beno?t Minisini From mohareve at ...626... Mon Aug 23 22:57:29 2010 From: mohareve at ...626... (M. Cs.) Date: Mon, 23 Aug 2010 22:57:29 +0200 Subject: [Gambas-user] Strange MP3 playback In-Reply-To: <201008232149.30966.gambas@...1...> References: <201008232149.30966.gambas@...1...> Message-ID: I found the workaround for the situation: The above mentioned happens when I record a sound with Audacity (e.g. YouTube) and save as MP3 with 48.000Hz as project frequency (Audigy-2). When I convert the sound with Audacity to 44.000 Hz, then convert the new MP3 to WAV with Nautilus-script, and finally reconvert with the same script to MP3 the problem disappears. At least I wrote down how to reproduce the bug. Csaba From rterry at ...1946... Mon Aug 23 23:51:29 2010 From: rterry at ...1946... (richard terry) Date: Tue, 24 Aug 2010 07:51:29 +1000 Subject: [Gambas-user] Clipboard problem in Gambas In-Reply-To: <201008231703.43786.gambas@...1...> References: <201008231703.43786.gambas@...1...> Message-ID: <201008240751.29811.rterry@...1946...> On Tuesday 24 August 2010 01:03:43 Beno?t Minisini wrote: > > 1. Thank you for your response, it works better now. > > > > 2.The problem of shortcuts keys Ctrl+C, Ctrl+X is: when I use those > > shortcut keys, I can paste only to the Gambas project editor window from > > where I copy (I can paste to different tabs). When I switch to other > > windows e.g gedit or an other Gambas project window, there's nothing to > > paste. But when return to the first Gambas project window, I still can > > paste. It's like that the shortcut keys use a "local clipboard" not the > > clipboard of system. But this problem doesn't happen with the context > > menu. (Paste here include both Ctrl+V and menu). > > Strange: it works perfectly as expected there. I copy some text with > CTRL+C, and I paste it in gedit with CTRL+V, and that works! > > Regards, > I've changed the topic header - but just to comment here, this is a long standing and inconsistant problem I've noticed in the linux environment gambas. I has has happened more to more when I do ctrl C or use a menu with a copy option, then switch immediately to gambas and do a Ctrl V or visa-versa. On the occasions it dosn't work, either nothing pastes, or what pastes was from some previous copy. Can't reproduce it not common - but just repeating that it does exist. My two linux distro's I've experienced this in as ARCH and KUbuntu. Regards Richard From lord.quo at ...626... Tue Aug 24 02:17:48 2010 From: lord.quo at ...626... (Lord Quo) Date: Mon, 23 Aug 2010 19:17:48 -0500 Subject: [Gambas-user] 'Public Enum' Question Message-ID: <28F870C895EB4BD9A9B9A1BC319B5F10@...2471...> Hi all, I have a Public Enum declaration, but I need (or want) to use a constants named Left and Right: Public Enum StyleHorizontalAlignment Automatic, Left, Center, Right, Fill, Justify, CenterAcrossSelection, Distributed, JustifyDistributed But when I compile the project, Gambas give me an error: 'Automatic' unexpected In class StyleEnums.module line 2 Can anyone help me? Thanks Daniel Rojas From doriano.blengino at ...1909... Tue Aug 24 10:33:40 2010 From: doriano.blengino at ...1909... (Doriano Blengino) Date: Tue, 24 Aug 2010 10:33:40 +0200 Subject: [Gambas-user] Extern howto/tutorial In-Reply-To: <201008232147.57248.gambas@...1...> References: <4C72A2F6.2040103@...1909...> <201008232147.57248.gambas@...1...> Message-ID: <4C7383E4.9060501@...1909...> Beno?t Minisini ha scritto: >> Hi, >> >> I finally wrote the tutorial about using external declarations. >> > This is not HTML, but plain text. If you can make an HTML version of your > document, with formatted text, I will be able to add it to the wiki. > Mmm... this is an excerpt from the first lines of "External-howto.html", the file attached to my previous message: This seems HTML to me... what document are you speaking about? Perhaps the .t2t one? > >> In the Drum Machine project, after having verified that it works >> correctly using pointers for read/write, I tried to create a new class >> which should be a gambas representation for an alsa event (which is a C >> struct). It does not work, and I don't know how to debug it (well, I >> could, using gdb or similar, but I was looking for a more direct way). >> > > Give me the C declaration, and your class declaration, and I will be able to > see if they correctly match. > Both are contained in the attached files - the C declaration, along with explanation and unrolling of structs/typedef/#define and so on, in the document; the Gambas class trying to emulate the C declaration, in the project "Gambas2-Drummachine....". For your convenience, I will repeat both at the end of this email. > > It is explicitely said that "WRITE #Pointer" is not supported anymore in > Gambas 3, in the WRITE documentation page. And so on for the READ instruction. > Sorry, I think that it is not so clear. "No more supported", or equivalent semantics, is totally absent from the page. It is true that there is a frame specifying the syntax for READ in Gambas3, but it speaks only about "READ #Stream". This makes me think that the "READ #Stream" syntax or behavior changed, not necessarily that pointers are no more valid. Perhaps would be better to say something more in the first frame, the one just below the title of the page: "WARNING! The syntax has changed in Gambas 3. READ/WRITE with pointers is no more supported in Gambas 3. See below." You said that you removed this syntax because of possible problems with memory alignment. What about BytePtr(), SinglePtr() and the alike? Do they not suffer from the same problem? (Just a curiosity). > The Gambas 3 structures were implemented for the use of extern C structures. > Moreover, in Gambas 3, you can now use Gambas functions as C function pointer > (as known as "callbacks") almost transparently. > I know... it was me that kindly requested that feature, I suppose... :-) And, apropos... I saw that alsa does not really provides a callback - there is something about in an undocumented source (an utility for alsa). Instead, what alsa provides, is a file descriptor which can be poll()ed or select()ed. Then I have seen a source for QT, which uses this capability. It seems the QT has a way to pass it a file descriptor, so it can raise events intermixed with GUI events. Glib too has something similar. I thought to use or fool some gambas stream to obtain the same result... but perhaps you have a better idea. Now let us see the problem about the alsa (musical) event structure. Giving that I made it to work, probably I did understand that structure and, if I only had a simple way to debug my gambas implementation, I would have had success. The alsa declaration is: snd_seq_event_type_t type unsigned char flags unsigned char tag unsigned char queue snd_seq_timestamp_t time snd_seq_addr_t source snd_seq_addr_t dest union { snd_seq_ev_note_t note ... The first field, type, is a byte. The fifth field, time, is a union having a total length of two ints, eight bytes in total. The source and dest fields are struct composed of two bytes each. After this fields, that are common to every alsa event, comes a specialized part for every different event. I only used the snd_seq_ev_note_t. My gambas translation is: ' Gambas class file ' object data to simulate a C struct type AS Byte ' snd_seq_event_type_t type flags AS Byte ' unsigned char flags tag AS Byte ' unsigned char tag PUBLIC queue AS Byte ' unsigned char queue time_tick AS Integer ' snd_seq_timestamp_t Time time_dummy AS Integer ' snd_seq_timestamp_t Time (2 part of union) PUBLIC sourceq AS Byte ' snd_seq_addr_t source (source client) PUBLIC sourcep AS Byte ' snd_seq_addr_t source (source port) PUBLIC destq AS Byte ' snd_seq_addr_t dest (dest client) PUBLIC destp AS Byte ' snd_seq_addr_t dest (dest port) ' note on fields of union { snd_seq_ev_note_t note ... channel AS Byte note AS Byte velocity AS Byte ' a few bytes as filler dummy1 AS Integer dummy2 AS Integer ... If you can use MIDI, or you have a soft synth like timidity, you can try to run the project to see what is going on. In FMain.class, in the subroutine btLegato2_Click(), you find: ' alsa.playnoteobj(-10 * i, 0, 60 + i, 100, 20) alsa.playnote(-10 * i, 0, 60 + i, 100, 20) Decomment the first line and comment-out the second. The second line prepares a C struct as the one above, using pointers to write in a memory region previously allocated, once for the whole life of the running program. The first line instead, tries to do the same by using a gambas class. An instance of that class is created once, and then repeatedly written to to set the various fields; finally, a pointer to the instance is passed to alsa, but alsa replies with "invalid argument". My machine is a 32-bit AMD Duron, with a Debian stable distribution; the test was made with gambas 2.0.0. Best regards, Doriano From lord.quo at ...626... Tue Aug 24 17:42:50 2010 From: lord.quo at ...626... (Lord Quo) Date: Tue, 24 Aug 2010 10:42:50 -0500 Subject: [Gambas-user] 'Public Enum' Question In-Reply-To: <28F870C895EB4BD9A9B9A1BC319B5F10@...2471...> References: <28F870C895EB4BD9A9B9A1BC319B5F10@...2471...> Message-ID: <57F36CC77BE34B7484B9BB4BBF870287@...2471...> Sorry, I wrote a terrible begginer error. This is my "correct" code: Public Enum Automatic, Left, Center, Right, Fill, Justify, CenterAcrossSelection, Distributed, JustifyDistributed But Left and Right give me problems because they are reserved word. Can I use them in another form? In VB.NET I remember that the solution is use [Left] and [Right] Thanks. From: Lord Quo Sent: Monday, August 23, 2010 7:17 PM To: Gambas-user at lists.sourceforge.net Subject: 'Public Enum' Question Hi all, I have a Public Enum declaration, but I need (or want) to use a constants named Left and Right: Public Enum StyleHorizontalAlignment Automatic, Left, Center, Right, Fill, Justify, CenterAcrossSelection, Distributed, JustifyDistributed But when I compile the project, Gambas give me an error: 'Automatic' unexpected In class StyleEnums.module line 2 Can anyone help me? Thanks Daniel Rojas From gb.france1159 at ...626... Tue Aug 24 17:49:03 2010 From: gb.france1159 at ...626... (=?ISO-8859-1?Q?Fran=E7ois?= Gallo) Date: Tue, 24 Aug 2010 17:49:03 +0200 Subject: [Gambas-user] 'Public Enum' Question In-Reply-To: <57F36CC77BE34B7484B9BB4BBF870287@...2471...> References: <28F870C895EB4BD9A9B9A1BC319B5F10@...2471...> <57F36CC77BE34B7484B9BB4BBF870287@...2471...> Message-ID: <1282664943.2565.1.camel@...2472...> Le mardi 24 ao?t 2010 ? 10:42 -0500, Lord Quo a ?crit : > Sorry, I wrote a terrible begginer error. > > This is my "correct" code: > > Public Enum Automatic, Left, Center, Right, Fill, Justify, CenterAcrossSelection, Distributed, JustifyDistributed > > But Left and Right give me problems because they are reserved word. Can I use them in another form? In VB.NET I remember that the solution is use [Left] and [Right] > > Thanks. > Yes you can by enclosing your variable name within { } . Fran?ois. > > From: Lord Quo > Sent: Monday, August 23, 2010 7:17 PM > To: Gambas-user at lists.sourceforge.net > Subject: 'Public Enum' Question > > > Hi all, I have a Public Enum declaration, but I need (or want) to use a constants named Left and Right: > > Public Enum StyleHorizontalAlignment Automatic, Left, Center, Right, Fill, Justify, CenterAcrossSelection, Distributed, JustifyDistributed > > But when I compile the project, Gambas give me an error: > > 'Automatic' unexpected > In class StyleEnums.module line 2 > > Can anyone help me? > > Thanks > > Daniel Rojas > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user From lord.quo at ...626... Tue Aug 24 17:58:13 2010 From: lord.quo at ...626... (Lord Quo) Date: Tue, 24 Aug 2010 10:58:13 -0500 Subject: [Gambas-user] 'Public Enum' Question In-Reply-To: <57F36CC77BE34B7484B9BB4BBF870287@...2471...> References: <28F870C895EB4BD9A9B9A1BC319B5F10@...2471...> <57F36CC77BE34B7484B9BB4BBF870287@...2471...> Message-ID: Ok, ok, I discovered the answer. I need to put my variable between braces: Public Enum Automatic, {Left}, Center, {Right}, Fill, Justify, CenterAcrossSelection, Distributed, JustifyDistributed Thanks a lot. From: Lord Quo Sent: Tuesday, August 24, 2010 10:42 AM To: Gambas-user at lists.sourceforge.net Subject: Re: 'Public Enum' Question Sorry, I wrote a terrible begginer error. This is my "correct" code: Public Enum Automatic, Left, Center, Right, Fill, Justify, CenterAcrossSelection, Distributed, JustifyDistributed But Left and Right give me problems because they are reserved word. Can I use them in another form? In VB.NET I remember that the solution is use [Left] and [Right] Thanks. From: Lord Quo Sent: Monday, August 23, 2010 7:17 PM To: Gambas-user at lists.sourceforge.net Subject: 'Public Enum' Question Hi all, I have a Public Enum declaration, but I need (or want) to use a constants named Left and Right: Public Enum StyleHorizontalAlignment Automatic, Left, Center, Right, Fill, Justify, CenterAcrossSelection, Distributed, JustifyDistributed But when I compile the project, Gambas give me an error: 'Automatic' unexpected In class StyleEnums.module line 2 Can anyone help me? Thanks Daniel Rojas From lord.quo at ...626... Tue Aug 24 18:19:11 2010 From: lord.quo at ...626... (Lord Quo) Date: Tue, 24 Aug 2010 11:19:11 -0500 Subject: [Gambas-user] 'Public Enum' Question In-Reply-To: <1282664943.2565.1.camel@...2472...> References: <28F870C895EB4BD9A9B9A1BC319B5F10@...2471...><57F36CC77BE34B7484B9BB4BBF870287@...2471...> <1282664943.2565.1.camel@...2472...> Message-ID: <3D07D6AFBEC7482BA9BF7972FB9CDD4E@...2471...> Thanks! :-) -------------------------------------------------- From: "Fran?oisGallo" Sent: Tuesday, August 24, 2010 10:49 AM To: "mailing list for gambas users" Subject: Re: [Gambas-user] 'Public Enum' Question > Yes you can by enclosing your variable name within { } . > > Fran?ois. From jussi.lahtinen at ...626... Tue Aug 24 18:22:19 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Tue, 24 Aug 2010 19:22:19 +0300 Subject: [Gambas-user] Clipboard problem in Gambas In-Reply-To: <201008240751.29811.rterry@...1946...> References: <201008231703.43786.gambas@...1...> <201008240751.29811.rterry@...1946...> Message-ID: I have noticed it with Ubuntu also. I use Parcellite clipboard manager, I'm not sure if it matters. That bug is rare and I have not figured out how to reproduce it. Jussi On Tue, Aug 24, 2010 at 00:51, richard terry wrote: > On Tuesday 24 August 2010 01:03:43 Beno?t Minisini wrote: >> > 1. Thank you for your response, it works better now. >> > >> > 2.The ?problem of shortcuts keys Ctrl+C, Ctrl+X is: when I use those >> > shortcut keys, I can paste only to the Gambas project editor window from >> > where I copy (I can paste to different tabs). When I switch to other >> > windows e.g gedit or an other Gambas project window, there's nothing to >> > paste. But when return to the first Gambas project window, I still can >> > paste. It's like that the shortcut keys use a "local clipboard" not the >> > clipboard of system. But this problem doesn't happen with the context >> > menu. (Paste here include both Ctrl+V and menu). >> >> Strange: it works perfectly as expected there. I copy some text with >> ?CTRL+C, and I paste it in gedit with CTRL+V, and that works! >> >> Regards, >> > > I've changed the topic header - but just to comment here, this is a long > standing and inconsistant problem I've noticed in the linux environment > gambas. > > I has has happened more to more when I do ctrl C or use a menu with a copy > option, then switch immediately to gambas and do a Ctrl V or visa-versa. > > On the occasions it dosn't work, either nothing pastes, or what pastes was > from some previous copy. > > Can't reproduce it ?not common - but just repeating that it does exist. My two > linux distro's I've experienced this in as ARCH and KUbuntu. > > > Regards > > Richard > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From Karl.Reinl at ...2345... Tue Aug 24 20:34:40 2010 From: Karl.Reinl at ...2345... (Charlie Reinl) Date: Tue, 24 Aug 2010 20:34:40 +0200 Subject: [Gambas-user] Clipboard problem in Gambas In-Reply-To: References: <201008231703.43786.gambas@...1...> <201008240751.29811.rterry@...1946...> Message-ID: <1282674880.6563.9.camel@...40...> Am Dienstag, den 24.08.2010, 19:22 +0300 schrieb Jussi Lahtinen: > I have noticed it with Ubuntu also. > I use Parcellite clipboard manager, I'm not sure if it matters. > That bug is rare and I have not figured out how to reproduce it. > > Jussi > > > > On Tue, Aug 24, 2010 at 00:51, richard terry wrote: > > On Tuesday 24 August 2010 01:03:43 Beno?t Minisini wrote: > >> > 1. Thank you for your response, it works better now. > >> > > >> > 2.The problem of shortcuts keys Ctrl+C, Ctrl+X is: when I use those > >> > shortcut keys, I can paste only to the Gambas project editor window from > >> > where I copy (I can paste to different tabs). When I switch to other > >> > windows e.g gedit or an other Gambas project window, there's nothing to > >> > paste. But when return to the first Gambas project window, I still can > >> > paste. It's like that the shortcut keys use a "local clipboard" not the > >> > clipboard of system. But this problem doesn't happen with the context > >> > menu. (Paste here include both Ctrl+V and menu). > >> > >> Strange: it works perfectly as expected there. I copy some text with > >> CTRL+C, and I paste it in gedit with CTRL+V, and that works! > >> > >> Regards, > >> > > > > I've changed the topic header - but just to comment here, this is a long > > standing and inconsistant problem I've noticed in the linux environment > > gambas. > > > > I has has happened more to more when I do ctrl C or use a menu with a copy > > option, then switch immediately to gambas and do a Ctrl V or visa-versa. > > > > On the occasions it dosn't work, either nothing pastes, or what pastes was > > from some previous copy. > > > > Can't reproduce it not common - but just repeating that it does exist. My two > > linux distro's I've experienced this in as ARCH and KUbuntu. > > > > > > Regards > > > > Richard > > Salut, I'v that troubles also, but I think in my case it's my KVM and/or the KVM and VMware-Workstation because I'v that on my Ubuntu 8.04 (a real computer) but also on Mandriva 2010.1 (also a real computer) and on all VMware-Workstations from SuSE 9.x over BSD to Windows (worst since Office 2007). I do not belief, that "Computers" or "OS" have problems with Ctrl+C/+V -- Cordialement Charlie From gb.france1159 at ...626... Tue Aug 24 21:33:58 2010 From: gb.france1159 at ...626... (=?ISO-8859-1?Q?Fran=E7ois?= Gallo) Date: Tue, 24 Aug 2010 21:33:58 +0200 Subject: [Gambas-user] 'Public Enum' Question In-Reply-To: <3D07D6AFBEC7482BA9BF7972FB9CDD4E@...2471...> References: <28F870C895EB4BD9A9B9A1BC319B5F10@...2471...> <57F36CC77BE34B7484B9BB4BBF870287@...2471...> <1282664943.2565.1.camel@...2472...> <3D07D6AFBEC7482BA9BF7972FB9CDD4E@...2471...> Message-ID: <1282678438.2565.2.camel@...2472...> No problem :) Le mardi 24 ao?t 2010 ? 11:19 -0500, Lord Quo a ?crit : > Thanks! :-) > > -------------------------------------------------- > From: "Fran?oisGallo" > Sent: Tuesday, August 24, 2010 10:49 AM > To: "mailing list for gambas users" > Subject: Re: [Gambas-user] 'Public Enum' Question > > > Yes you can by enclosing your variable name within { } . > > > > Fran?ois. > > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user From eilert-sprachen at ...221... Wed Aug 25 13:11:43 2010 From: eilert-sprachen at ...221... (Rolf-Werner Eilert) Date: Wed, 25 Aug 2010 13:11:43 +0200 Subject: [Gambas-user] Find method and string question Message-ID: <4C74FA6F.7080606@...221...> Hi folks, Just to make sure I have got it right: Does .Find only find whole strings, not part-strings? Say flx[5] contains "This is a string" and I search for flx.Find("string", gb.Text) it doesn't find it (but should find number 5). If flx[5] contains only "string", it is found. At least it appears so, my string here is divided not by whitespaces but by chr$(6), and I was searching for one of the part-strings. It didn't recognize it, so that's why I ask just to make sure. Regards Rolf From jussi.lahtinen at ...626... Wed Aug 25 21:30:51 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Wed, 25 Aug 2010 22:30:51 +0300 Subject: [Gambas-user] To wish list... Message-ID: Hi! I would like to have TimeLeft property to timer object. It is only missing thing which forces me to write my own delay function. So, nothing very important, but if this is easy to implement... Jussi From gambas at ...1... Wed Aug 25 21:36:04 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Wed, 25 Aug 2010 21:36:04 +0200 Subject: [Gambas-user] To wish list... In-Reply-To: References: Message-ID: <201008252136.04491.gambas@...1...> > Hi! > I would like to have TimeLeft property to timer object. > It is only missing thing which forces me to write my own delay function. > > So, nothing very important, but if this is easy to implement... > > Jussi Can you explain why you need to know that? -- Beno?t Minisini From gambas.fr at ...626... Wed Aug 25 21:46:18 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Wed, 25 Aug 2010 21:46:18 +0200 Subject: [Gambas-user] To wish list... In-Reply-To: <201008252136.04491.gambas@...1...> References: <201008252136.04491.gambas@...1...> Message-ID: ha ha ha ... it remember me something :) Le 25 ao?t 2010 21:36, Beno?t Minisini a ?crit : >> Hi! >> I would like to have TimeLeft property to timer object. >> It is only missing thing which forces me to write my own delay function. >> >> So, nothing very important, but if this is easy to implement... >> >> Jussi > > Can you explain why you need to know that? > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From gambas at ...1... Wed Aug 25 22:12:14 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Wed, 25 Aug 2010 22:12:14 +0200 Subject: [Gambas-user] Extern howto/tutorial In-Reply-To: <4C7383E4.9060501@...1909...> References: <201008232147.57248.gambas@...1...> <4C7383E4.9060501@...1909...> Message-ID: <201008252212.14249.gambas@...1...> > Beno?t Minisini ha scritto: > >> Hi, > >> > >> I finally wrote the tutorial about using external declarations. > > > > This is not HTML, but plain text. If you can make an HTML version of your > > document, with formatted text, I will be able to add it to the wiki. > > Mmm... this is an excerpt from the first lines of "External-howto.html", > the file attached to my previous message: > > "http://www.w3.org/TR/html4/loose.dtd"> > > > > > > This seems HTML to me... what document are you speaking about? Perhaps > the .t2t one? > No: there is no HTML at all in your mail. > >> In the Drum Machine project, after having verified that it works > >> correctly using pointers for read/write, I tried to create a new class > >> which should be a gambas representation for an alsa event (which is a C > >> struct). It does not work, and I don't know how to debug it (well, I > >> could, using gdb or similar, but I was looking for a more direct way). > > > > Give me the C declaration, and your class declaration, and I will be able > > to see if they correctly match. > > Both are contained in the attached files - the C declaration, along with > explanation and unrolling of structs/typedef/#define and so on, in the > document; the Gambas class trying to emulate the C declaration, in the > project "Gambas2-Drummachine....". For your convenience, I will repeat > both at the end of this email. > > > It is explicitely said that "WRITE #Pointer" is not supported anymore in > > Gambas 3, in the WRITE documentation page. And so on for the READ > > instruction. > > Sorry, I think that it is not so clear. "No more supported", or > equivalent semantics, is totally absent from the page. It is true that > there is a frame specifying the syntax for READ in Gambas3, but it > speaks only about "READ #Stream". This makes me think that the "READ > #Stream" syntax or behavior changed, not necessarily that pointers are > no more valid. Perhaps would be better to say something more in the > first frame, the one just below the title of the page: "WARNING! The > syntax has changed in Gambas 3. READ/WRITE with pointers is no more > supported in Gambas 3. See below." That is explicitetly mentioned in the READ & WRITE documentation page. See the joined screenshot if you don't trust me. :-) > > You said that you removed this syntax because of possible problems with > memory alignment. What about BytePtr(), SinglePtr() and the alike? Do > they not suffer from the same problem? (Just a curiosity). > > > The Gambas 3 structures were implemented for the use of extern C > > structures. Moreover, in Gambas 3, you can now use Gambas functions as C > > function pointer (as known as "callbacks") almost transparently. > > I know... it was me that kindly requested that feature, I suppose... :-) > And, apropos... > I saw that alsa does not really provides a callback - there is something > about in an undocumented source (an utility for alsa). Instead, what > alsa provides, is a file descriptor which can be poll()ed or select()ed. > Then I have seen a source for QT, which uses this capability. It seems > the QT has a way to pass it a file descriptor, so it can raise events > intermixed with GUI events. Glib too has something similar. I thought to > use or fool some gambas stream to obtain the same result... but perhaps > you have a better idea. Actually the interpreter can do it, but there is no function in the language for that. I will think about a solution... Maybe a new stream object. > > Now let us see the problem about the alsa (musical) event structure. > Giving that I made it to work, probably I did understand that structure > and, if I only had a simple way to debug my gambas implementation, I > would have had success. The alsa declaration is: > > snd_seq_event_type_t type > unsigned char flags > unsigned char tag > unsigned char queue > snd_seq_timestamp_t time > snd_seq_addr_t source > snd_seq_addr_t dest > union { > snd_seq_ev_note_t note > ... > > The first field, type, is a byte. The fifth field, time, is a union > having a total length of two ints, eight bytes in total. > The source and dest fields are struct composed of two bytes each. After > this fields, that are common to every alsa event, comes a specialized > part for every different event. I only used the snd_seq_ev_note_t. > > My gambas translation is: > > ' Gambas class file > > ' object data to simulate a C struct > > type AS Byte ' snd_seq_event_type_t type > flags AS Byte ' unsigned char flags > tag AS Byte ' unsigned char tag > PUBLIC queue AS Byte ' unsigned char queue > time_tick AS Integer ' snd_seq_timestamp_t Time > time_dummy AS Integer ' snd_seq_timestamp_t Time (2 part of union) > PUBLIC sourceq AS Byte ' snd_seq_addr_t source (source client) > PUBLIC sourcep AS Byte ' snd_seq_addr_t source (source port) > PUBLIC destq AS Byte ' snd_seq_addr_t dest (dest client) > PUBLIC destp AS Byte ' snd_seq_addr_t dest (dest port) > > ' note on fields of union { snd_seq_ev_note_t note ... > channel AS Byte > note AS Byte > velocity AS Byte > > ' a few bytes as filler > dummy1 AS Integer > dummy2 AS Integer > ... > > If you can use MIDI, or you have a soft synth like timidity, you can try > to run the project to see what is going on. > In FMain.class, in the subroutine btLegato2_Click(), you find: > > ' alsa.playnoteobj(-10 * i, 0, 60 + i, 100, 20) > alsa.playnote(-10 * i, 0, 60 + i, 100, 20) > > Decomment the first line and comment-out the second. The second line > prepares a C struct as the one above, using pointers to write in a > memory region previously allocated, once for the whole life of the > running program. The first line instead, tries to do the same by using a > gambas class. An instance of that class is created once, and then > repeatedly written to to set the various fields; finally, a pointer to > the instance is passed to alsa, but alsa replies with "invalid > argument". My machine is a 32-bit AMD Duron, with a Debian stable > distribution; the test was made with gambas 2.0.0. > > Best regards, > Doriano > Note that 'WRITE #p, 0, 1' does not write one byte, but only the integer 0 on four bytes. You must do 'WRITE #p, chr$(0), 1' WRITE #p, outq writes four bytes as outq is an integer, not one byte. And so on... I think you must check all your use of the WRITE instruction, which write a number of bytes that depends on the datatype of its second argument. In Gambas 3, you say explicitely what datatype you want to write (WRITE #Stream, Expression As Datatype). As for the use of an object instead of a memory allocation, I don't know. I must study that in detail. When passing an object to an extern function, the extern function receives the memory address of the first field. So now I must check that all datatypes match, and that there is no alignment problem. Regards, -- Beno?t Minisini -------------- next part -------------- A non-text attachment was scrubbed... Name: read.jpeg Type: image/jpeg Size: 131444 bytes Desc: not available URL: From jussi.lahtinen at ...626... Wed Aug 25 22:17:58 2010 From: jussi.lahtinen at ...626... (Jussi Lahtinen) Date: Wed, 25 Aug 2010 23:17:58 +0300 Subject: [Gambas-user] To wish list... In-Reply-To: <201008252136.04491.gambas@...1...> References: <201008252136.04491.gambas@...1...> Message-ID: This time I would use it with trayicon (mouse over) to inform user about when next event is going to occur. There was an other reason long time ago when I needed that... I just couldn't remember. I wonder if it was something more general... Jussi 2010/8/25 Beno?t Minisini > > Hi! > > I would like to have TimeLeft property to timer object. > > It is only missing thing which forces me to write my own delay function. > > > > So, nothing very important, but if this is easy to implement... > > > > Jussi > > Can you explain why you need to know that? > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From trat50 at ...67... Thu Aug 26 02:00:20 2010 From: trat50 at ...67... (t rat) Date: Thu, 26 Aug 2010 00:00:20 +0000 Subject: [Gambas-user] To wish list... (Tom Harvey) Message-ID: Hi, I would like an option in DateChooser to display Sunday as the 1st day of the week on DateChooser. Presently Monday (the 2nd day of the week) is displayed as the first day of the week in DateChooser. Thanks for everything! Using Gambas 2.20 on PCLinuxOS 2010. From girardhenri at ...67... Thu Aug 26 05:47:50 2010 From: girardhenri at ...67... (Henri Girard) Date: Thu, 26 Aug 2010 03:47:50 +0000 Subject: [Gambas-user] maverick gambas3 compilation error In-Reply-To: References: Message-ID: Hi, I tried compiling gambas3 on maverick and I got this error ? Need help please Henri 686-linux-gnu/4.4.5/../../.. -L//lib -L//usr/lib -L/usr/lib/i686-linux-gnu -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i686-linux-gnu/4.4.5/crtendS.o /usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crtn.o -pthread -Wl,-soname -Wl,gb.gtk.opengl.so.0 -o .libs/gb.gtk.opengl.so.0.0.0 libtool: link: (cd ".libs" && rm -f "gb.gtk.opengl.so.0" && ln -s "gb.gtk.opengl.so.0.0.0" "gb.gtk.opengl.so.0") libtool: link: (cd ".libs" && rm -f "gb.gtk.opengl.so" && ln -s "gb.gtk.opengl.so.0.0.0" "gb.gtk.opengl.so") /bin/sed: can't read /usr/lib/libgdk_pixbuf-2.0.la: No such file or directory libtool: link: `/usr/lib/libgdk_pixbuf-2.0.la' is not a valid libtool archive make[5]: *** [gb.gtk.opengl.la] Erreur 1 make[5]: quittant le r?pertoire ? /root/svn/trunk/gb.gtk/src/opengl ? make[4]: *** [all-recursive] Erreur 1 make[4]: quittant le r?pertoire ? /root/svn/trunk/gb.gtk/src ? make[3]: *** [all-recursive] Erreur 1 make[3]: quittant le r?pertoire ? /root/svn/trunk/gb.gtk ? make[2]: *** [all] Erreur 2 make[2]: quittant le r?pertoire ? /root/svn/trunk/gb.gtk ? make[1]: *** [all-recursive] Erreur 1 make[1]: quittant le r?pertoire ? /root/svn/trunk ? make: *** [all] Erreur 2 From eilert-sprachen at ...221... Thu Aug 26 08:18:13 2010 From: eilert-sprachen at ...221... (Rolf-Werner Eilert) Date: Thu, 26 Aug 2010 08:18:13 +0200 Subject: [Gambas-user] To wish list... (Tom Harvey) In-Reply-To: References: Message-ID: <4C760725.7060609@...221...> Am 26.08.2010 02:00, schrieb t rat: > > Hi, > I would like an option in DateChooser to display Sunday as the 1st day of the week on DateChooser. Presently Monday (the 2nd day of the week) is displayed as the first day of the week in DateChooser. Thanks for everything! > > Using Gambas 2.20 on PCLinuxOS 2010. > In Europe we do it like that. All calendars begin with Monday. Sunday is part of the weekend. I know that in Germany before we had a big discussion about it, but then we switched to the current system. Must have been in the sixties or early seventies, just the time when I started school, so I heard about the final discussion. But: isn't that a matter of the locale? If you say KDE for instance that you are in the US, all calendar apps should recognize this. Regards Rolf From doriano.blengino at ...1909... Thu Aug 26 09:24:33 2010 From: doriano.blengino at ...1909... (Doriano Blengino) Date: Thu, 26 Aug 2010 09:24:33 +0200 Subject: [Gambas-user] Extern howto/tutorial In-Reply-To: <201008252212.14249.gambas@...1...> References: <201008232147.57248.gambas@...1...> <4C7383E4.9060501@...1909...> <201008252212.14249.gambas@...1...> Message-ID: <4C7616B1.6060005@...1909...> Beno?t Minisini ha scritto: >> Beno?t Minisini ha scritto: >> >>>> Hi, >>>> >>>> I finally wrote the tutorial about using external declarations. >>>> >>> This is not HTML, but plain text. If you can make an HTML version of your >>> document, with formatted text, I will be able to add it to the wiki. >>> >> Mmm... this is an excerpt from the first lines of "External-howto.html", >> the file attached to my previous message: >> >> > "http://www.w3.org/TR/html4/loose.dtd"> >> >> >> >> >> >> This seems HTML to me... what document are you speaking about? Perhaps >> the .t2t one? >> >> > > No: there is no HTML at all in your mail. > Now I am leaving for two days - when I will return we will see all that things in more detail. Regards, Doriano From gambas.fr at ...626... Thu Aug 26 10:28:24 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Thu, 26 Aug 2010 10:28:24 +0200 Subject: [Gambas-user] To wish list... (Tom Harvey) In-Reply-To: <4C760725.7060609@...221...> References: <4C760725.7060609@...221...> Message-ID: 2010/8/26 Rolf-Werner Eilert : > Am 26.08.2010 02:00, schrieb t rat: >> >> Hi, >> I would like an option in DateChooser to display Sunday as the 1st day of the week on DateChooser. ?Presently Monday (the 2nd day of the week) is displayed as the first day of the week in DateChooser. ?Thanks for everything! >> >> Using Gambas 2.20 on PCLinuxOS 2010. >> > > In Europe we do it like that. All calendars begin with Monday. Sunday is > part of the weekend. I know that in Germany before ?we had a big > discussion about it, but then we switched to the current system. Must > have been in the sixties or early seventies, just the time when I > started school, so I heard about the final discussion. > > But: isn't that a matter of the locale? If you say KDE for instance that > you are in the US, all calendar apps should recognize this. gambas calendar is made in gambas ... > > Regards > > Rolf > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From gambas.fr at ...626... Thu Aug 26 10:34:34 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Thu, 26 Aug 2010 10:34:34 +0200 Subject: [Gambas-user] To wish list... In-Reply-To: References: <201008252136.04491.gambas@...1...> Message-ID: i just want to say that i've queried something like that 3 week ago :) Something that allow to delay mouse events ... for exemple for mouse there is two case ... Mouse is in the widget during a time ... or mouse button is pressed during a time ... and for keyboard just button is pressed during a time. But how to make that usable ? i use timer for that On mouse down -> timer.start On mouse up -> timer stop on mouse leave -> timer stop timer timer -> do what you need timer.delay = 1000 From gambas.fr at ...626... Thu Aug 26 10:34:34 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Thu, 26 Aug 2010 10:34:34 +0200 Subject: [Gambas-user] To wish list... In-Reply-To: References: <201008252136.04491.gambas@...1...> Message-ID: i just want to say that i've queried something like that 3 week ago :) Something that allow to delay mouse events ... for exemple for mouse there is two case ... Mouse is in the widget during a time ... or mouse button is pressed during a time ... and for keyboard just button is pressed during a time. But how to make that usable ? i use timer for that On mouse down -> timer.start On mouse up -> timer stop on mouse leave -> timer stop timer timer -> do what you need timer.delay = 1000 From wdahn at ...1000... Thu Aug 26 07:04:30 2010 From: wdahn at ...1000... (Werner) Date: Thu, 26 Aug 2010 13:04:30 +0800 Subject: [Gambas-user] To wish list... In-Reply-To: References: Message-ID: <4C75F5DE.5050100@...1000...> On 26/08/10 03:30, Jussi Lahtinen wrote: > Hi! > I would like to have TimeLeft property to timer object. > It is only missing thing which forces me to write my own delay function. > > So, nothing very important, but if this is easy to implement... > > Jussi I think that's a very good idea. Werner From gambas at ...1... Thu Aug 26 17:30:20 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Thu, 26 Aug 2010 17:30:20 +0200 Subject: [Gambas-user] maverick gambas3 compilation error In-Reply-To: References: Message-ID: <201008261730.20135.gambas@...1...> > Hi, > > I tried compiling gambas3 on maverick and I got this error ? > Need help please > Henri > > 686-linux-gnu/4.4.5/../../.. -L//lib -L//usr/lib -L/usr/lib/i686-linux-gnu > -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i686-linux-gnu/4.4.5/crtendS.o > /usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crtn.o -pthread > -Wl,-soname -Wl,gb.gtk.opengl.so.0 -o .libs/gb.gtk.opengl.so.0.0.0 > libtool: link: (cd ".libs" && rm -f "gb.gtk.opengl.so.0" && ln -s > "gb.gtk.opengl.so.0.0.0" "gb.gtk.opengl.so.0") libtool: link: (cd ".libs" > && rm -f "gb.gtk.opengl.so" && ln -s "gb.gtk.opengl.so.0.0.0" > "gb.gtk.opengl.so") /bin/sed: can't read /usr/lib/libgdk_pixbuf-2.0.la: No > such file or directory libtool: link: `/usr/lib/libgdk_pixbuf-2.0.la' is > not a valid libtool archive It should be a valid archive! I think that is a bug in maverick. Regards, -- Beno?t Minisini From gambas at ...1... Thu Aug 26 17:35:31 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Thu, 26 Aug 2010 17:35:31 +0200 Subject: [Gambas-user] To wish list... (Tom Harvey) In-Reply-To: References: Message-ID: <201008261735.31273.gambas@...1...> > Hi, > I would like an option in DateChooser to display Sunday as the 1st day of > the week on DateChooser. Presently Monday (the 2nd day of the week) is > displayed as the first day of the week in DateChooser. Thanks for > everything! > > Using Gambas 2.20 on PCLinuxOS 2010. > Apparently the first day of the week is Monday everywhere but in US! If somebody can confirm... I will make a change in Gambas 3, and if I have time, I will try to backport it to Gambas 2. Regards, -- Beno?t Minisini From gambas at ...1... Thu Aug 26 17:59:04 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Thu, 26 Aug 2010 17:59:04 +0200 Subject: [Gambas-user] To wish list... (Tom Harvey) In-Reply-To: <201008261735.31273.gambas@...1...> References: <201008261735.31273.gambas@...1...> Message-ID: <201008261759.04189.gambas@...1...> > > Hi, > > I would like an option in DateChooser to display Sunday as the 1st day of > > the week on DateChooser. Presently Monday (the 2nd day of the week) is > > displayed as the first day of the week in DateChooser. Thanks for > > everything! > > > > Using Gambas 2.20 on PCLinuxOS 2010. > > Apparently the first day of the week is Monday everywhere but in US! If > somebody can confirm... > > I will make a change in Gambas 3, and if I have time, I will try to > backport it to Gambas 2. > > Regards, OK, you got your change in revision #3141. Regards, -- Beno?t Minisini From gb.france1159 at ...626... Thu Aug 26 18:17:34 2010 From: gb.france1159 at ...626... (=?ISO-8859-1?Q?Fran=E7ois?= Gallo) Date: Thu, 26 Aug 2010 18:17:34 +0200 Subject: [Gambas-user] maverick gambas3 compilation error In-Reply-To: <201008261730.20135.gambas@...1...> References: <201008261730.20135.gambas@...1...> Message-ID: <1282839454.22217.1.camel@...2472...> Le jeudi 26 ao?t 2010 ? 17:30 +0200, Beno?t Minisini a ?crit : > > Hi, > > > > I tried compiling gambas3 on maverick and I got this error ? > > Need help please > > Henri > > > > 686-linux-gnu/4.4.5/../../.. -L//lib -L//usr/lib -L/usr/lib/i686-linux-gnu > > -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i686-linux-gnu/4.4.5/crtendS.o > > /usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crtn.o -pthread > > -Wl,-soname -Wl,gb.gtk.opengl.so.0 -o .libs/gb.gtk.opengl.so.0.0.0 > > libtool: link: (cd ".libs" && rm -f "gb.gtk.opengl.so.0" && ln -s > > "gb.gtk.opengl.so.0.0.0" "gb.gtk.opengl.so.0") libtool: link: (cd ".libs" > > && rm -f "gb.gtk.opengl.so" && ln -s "gb.gtk.opengl.so.0.0.0" > > "gb.gtk.opengl.so") /bin/sed: can't read /usr/lib/libgdk_pixbuf-2.0.la: No > > such file or directory libtool: link: `/usr/lib/libgdk_pixbuf-2.0.la' is > > not a valid libtool archive > It should be a valid archive! I think that is a bug in maverick. I think so as well. From trat50 at ...67... Thu Aug 26 23:41:10 2010 From: trat50 at ...67... (t rat) Date: Thu, 26 Aug 2010 21:41:10 +0000 Subject: [Gambas-user] To wish list... (Rolf-Werner Eilert) Message-ID: >> Hi, >> I would like an option in DateChooser to display Sunday as the 1st day of the week on DateChooser. Presently Monday (the 2nd day of the week) is displayed as the first day of the week in DateChooser. Thanks for everything! >> >> Using Gambas 2.20 on PCLinuxOS 2010. >> > >In Europe we do it like that. All calendars begin with Monday. Sunday is >part of the weekend. I know that in Germany before we had a big >discussion about it, but then we switched to the current system. Must >have been in the sixties or early seventies, just the time when I >started school, so I heard about the final discussion. > >But: isn't that a matter of the locale? If you say KDE for instance that >you are in the US, all calendar apps should recognize this. > >Regards > >Rolf Hi Rolf, Thanks for the reply, but changing KDE locale didn't change the DateChooser display. I am writing an application to generate the Bible Calendar for this year and more. The user plugs in dates of New Moons sightings to generate a current Biblical month. The user selects (Monday-Sunday DateChooser) new moon dates on DateChooser, then the Biblical Calendar is generated and displayed (Sunday-Sabbath). It doesn't change the generated calendar results - but it can confuse the users. Thanks, Tom From girardhenri at ...67... Fri Aug 27 11:03:04 2010 From: girardhenri at ...67... (Henri Girard) Date: Fri, 27 Aug 2010 09:03:04 +0000 Subject: [Gambas-user] maverick gambas3 compilation error In-Reply-To: <1282839454.22217.1.camel@...2472...> References: , , <201008261730.20135.gambas@...1...>, <1282839454.22217.1.camel@...2472...> Message-ID: > From: gb.france1159 at ...626... > To: gambas-user at lists.sourceforge.net > Date: Thu, 26 Aug 2010 18:17:34 +0200 > Subject: Re: [Gambas-user] maverick gambas3 compilation error > > Le jeudi 26 ao?t 2010 ? 17:30 +0200, Beno?t Minisini a ?crit : > > > Hi, > > > > > > I tried compiling gambas3 on maverick and I got this error ? > > > Need help please > > > Henri > > > > > > 686-linux-gnu/4.4.5/../../.. -L//lib -L//usr/lib -L/usr/lib/i686-linux-gnu > > > -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i686-linux-gnu/4.4.5/crtendS.o > > > /usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crtn.o -pthread > > > -Wl,-soname -Wl,gb.gtk.opengl.so.0 -o .libs/gb.gtk.opengl.so.0.0.0 > > > libtool: link: (cd ".libs" && rm -f "gb.gtk.opengl.so.0" && ln -s > > > "gb.gtk.opengl.so.0.0.0" "gb.gtk.opengl.so.0") libtool: link: (cd ".libs" > > > && rm -f "gb.gtk.opengl.so" && ln -s "gb.gtk.opengl.so.0.0.0" > > > "gb.gtk.opengl.so") /bin/sed: can't read /usr/lib/libgdk_pixbuf-2.0.la: No > > > such file or directory libtool: link: `/usr/lib/libgdk_pixbuf-2.0.la' is > > > not a valid libtool archive > > > It should be a valid archive! I think that is a bug in maverick. > > I think so as well. Make is good it's just installation with make install which fails. i installed gambas2 from apt and it works I will send a bug to maverick > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user From mike.crean at ...1940... Fri Aug 27 14:09:58 2010 From: mike.crean at ...1940... (Mike) Date: Fri, 27 Aug 2010 20:09:58 +0800 Subject: [Gambas-user] To wish list... (Tom Harvey) In-Reply-To: <201008261735.31273.gambas@...1...> References: <201008261735.31273.gambas@...1...> Message-ID: <1282910998.3901.1.camel@...2473...> Benoit, Australia, Sunday is the 1st day of the week. Regards Mike On Thu, 2010-08-26 at 17:35 +0200, Beno?t Minisini wrote: > > Hi, > > I would like an option in DateChooser to display Sunday as the 1st day of > > the week on DateChooser. Presently Monday (the 2nd day of the week) is > > displayed as the first day of the week in DateChooser. Thanks for > > everything! > > > > Using Gambas 2.20 on PCLinuxOS 2010. > > > > Apparently the first day of the week is Monday everywhere but in US! If > somebody can confirm... > > I will make a change in Gambas 3, and if I have time, I will try to backport > it to Gambas 2. > > Regards, > From lord.quo at ...626... Fri Aug 27 20:40:19 2010 From: lord.quo at ...626... (Daniel Rojas) Date: Fri, 27 Aug 2010 13:40:19 -0500 Subject: [Gambas-user] Question about collections and inheritance Message-ID: Hi all. I'm trying to code a very basic Xml Excel Generator, and I'm workin with a collection. This is my code: ' Gambas class file Inherits Collection Public Function Add($ID As String) As Style Dim $style As New Style($ID) Super.Add($style, $ID) Return $style End Public Function _GetXml() As String Dim $style As Style Dim $text As String = "\t\n" For Each $style In Me $text &= $style._GetXml() & "\n" Next $text &= "\t" Return $text End Style is another class I have. My class inherits the Collection class and I override the Add function. All of this works fine, my question is about another Collection functionality: With a normal Collection we can do something like this: Dim $col As Collection $col.Add("My value", "key") Print *$col["key"]* I can access to my item whit his "key". How can I override this functionality in my class, because Gambas return me a Variant data type element and I want to return my own data type, my Style class. Thanks. P.S. Sorry my english, I trying to learn it but I'm still newbie Daniel Quintero desde la Ciudad de M?xico From doriano.blengino at ...1909... Sat Aug 28 09:05:37 2010 From: doriano.blengino at ...1909... (Doriano Blengino) Date: Sat, 28 Aug 2010 09:05:37 +0200 Subject: [Gambas-user] Extern howto/tutorial In-Reply-To: <201008252212.14249.gambas@...1...> References: <201008232147.57248.gambas@...1...> <4C7383E4.9060501@...1909...> <201008252212.14249.gambas@...1...> Message-ID: <4C78B541.8000402@...1909...> Beno?t Minisini ha scritto: >> Beno?t Minisini ha scritto: >> >> > No: there is no HTML at all in your mail. > Very strange. A friend of us picked the same document from the gambas list, and put it on the italian site of gambas (www.gambas-it.org). Anyway, I attach a tarred copy of the new document, which contains corrections. >>> It is explicitely said that "WRITE #Pointer" is not supported anymore in >>> Gambas 3, in the WRITE documentation page. And so on for the READ >>> instruction. >>> >> Sorry, I think that it is not so clear. "No more supported", or >> equivalent semantics, is totally absent from the page. It is true that >> there is a frame specifying the syntax for READ in Gambas3, but it >> speaks only about "READ #Stream". This makes me think that the "READ >> #Stream" syntax or behavior changed, not necessarily that pointers are >> no more valid. Perhaps would be better to say something more in the >> first frame, the one just below the title of the page: "WARNING! The >> syntax has changed in Gambas 3. READ/WRITE with pointers is no more >> supported in Gambas 3. See below." >> > > That is explicitetly mentioned in the READ & WRITE documentation page. See the > joined screenshot if you don't trust me. :-) > My copy of the documentation is different. With all evidence, a correction about this topic was added after I downloaded the gambas sources from sourceforge. Anyway, the important thing is that now the documentation is correct. > Note that 'WRITE #p, 0, 1' does not write one byte, but only the integer 0 on > four bytes. You must do 'WRITE #p, chr$(0), 1' > > WRITE #p, outq writes four bytes as outq is an integer, not one byte. > > And so on... I think you must check all your use of the WRITE instruction, > which write a number of bytes that depends on the datatype of its second > argument. > I corrected the above errors, and attach the revised project. It worked anyway, because the extraneous bytes written after the intended ones, were afterwards rewritten with correct values. Perhaps the compiler could reject statements like "write #p, 0, 1", or perhaps gambas2 is going to museum in favor of gambas3. In a previous email I said that by declaring a constant as a byte, and then writing it out with a "write #pointer...", 4 bytes were written instead of one. This is not totally true - I did'nt verified. What is true, instead, is that declaring a constant as byte, and then writing it out to a stream, 4 bytes are written. This was verified in an old temptative of the drum machine, where OSS was used instead of alsa, and a gambas stream (file) was used to write to the file /dev/sequencer2. Regards, Doriano Blengino -------------- next part -------------- A non-text attachment was scrubbed... Name: Gambas2-extern-howto.tgz Type: application/x-gtar Size: 14598 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Gambas2-DrumMachine-0.1.4.tar.gz Type: application/x-tgz Size: 15922 bytes Desc: not available URL: From reynaldi.jansen at ...626... Sat Aug 28 10:57:29 2010 From: reynaldi.jansen at ...626... (Reynaldi Jansen) Date: Sat, 28 Aug 2010 15:57:29 +0700 Subject: [Gambas-user] Need help on Tabstrip Message-ID: Hello. I want to ask how to copy control in tab to another tab? I have a tabstrip with textarea, and when user want new tab, i want it create a new tab with textarea too inside the new tab... I don't have any idea how to do this on gambas... Sorry for a poor question :-( Thanks! From gambas at ...1... Sat Aug 28 12:15:15 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sat, 28 Aug 2010 12:15:15 +0200 Subject: [Gambas-user] To wish list... (Tom Harvey) In-Reply-To: <1282910998.3901.1.camel@...2473...> References: <201008261735.31273.gambas@...1...> <1282910998.3901.1.camel@...2473...> Message-ID: <201008281215.15541.gambas@...1...> > Benoit, > > Australia, Sunday is the 1st day of the week. > > Regards > Mike > Yep. According to Wikipedia, Sunday is the first day of the week mainly in monotheistic religions. So I cannot rely on the country! I must let the programmer decide, and provide a property in the DateChooser control. Or better a global property in the System class. Regards, -- Beno?t Minisini From rospolosco at ...152... Sat Aug 28 18:25:29 2010 From: rospolosco at ...152... (Stefano Palmeri) Date: Sat, 28 Aug 2010 18:25:29 +0200 Subject: [Gambas-user] Need help on Tabstrip In-Reply-To: References: Message-ID: <201008281825.29431.rospolosco@...152...> Il sabato 28 agosto 2010 10:57:29 Reynaldi Jansen ha scritto: > Hello. > > I want to ask how to copy control in tab to another tab? > I have a tabstrip with textarea, and when user want new tab, i want it > create a new tab with textarea too inside the new tab... > I don't have any idea how to do this on gambas... > Sorry for a poor question :-( > > Thanks! Hi. I attached a little example. The GTK version is needed if you're under a 'gtk' desktop, but it works well even under qt. So the GTK version is the good one; it has two more lines of code because the NOT-gtk version crashes the Gambas IDE. Is it a bug, Benoit? > --------------------------------------------------------------------------- >--- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be > part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -------------- next part -------------- A non-text attachment was scrubbed... Name: GTK-tabstrip-0.0.2.tar.gz Type: application/x-tgz Size: 8071 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: tabstrip-0.0.2.tar.gz Type: application/x-tgz Size: 8051 bytes Desc: not available URL: From gambas at ...1... Sat Aug 28 22:05:28 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sat, 28 Aug 2010 22:05:28 +0200 Subject: [Gambas-user] Need help on Tabstrip In-Reply-To: <201008281825.29431.rospolosco@...152...> References: <201008281825.29431.rospolosco@...152...> Message-ID: <201008282205.28362.gambas@...1...> > Il sabato 28 agosto 2010 10:57:29 Reynaldi Jansen ha scritto: > > Hello. > > > > I want to ask how to copy control in tab to another tab? > > I have a tabstrip with textarea, and when user want new tab, i want it > > create a new tab with textarea too inside the new tab... > > I don't have any idea how to do this on gambas... > > Sorry for a poor question :-( > > > > Thanks! > > Hi. I attached a little example. > > The GTK version is needed if you're under a 'gtk' desktop, but it works > well even under qt. So the GTK version is the good one; it has two more > lines of code because the NOT-gtk version crashes the Gambas IDE. Is it a > bug, Benoit? > I don't see any difference in the source code of both projects. Both work as expected. Are you sure that you sent the good files? -- Beno?t Minisini From gambas at ...1... Sat Aug 28 23:25:10 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sat, 28 Aug 2010 23:25:10 +0200 Subject: [Gambas-user] To wish list... (Tom Harvey) In-Reply-To: <201008281215.15541.gambas@...1...> References: <1282910998.3901.1.camel@...2473...> <201008281215.15541.gambas@...1...> Message-ID: <201008282325.10180.gambas@...1...> > > Benoit, > > > > Australia, Sunday is the 1st day of the week. > > > > Regards > > Mike > > Yep. According to Wikipedia, Sunday is the first day of the week mainly in > monotheistic religions. > > So I cannot rely on the country! I must let the programmer decide, and > provide a property in the DateChooser control. Or better a global property > in the System class. > > Regards, System.FirstDayOfWeek has been implemented in revision #3151. Regards, -- Beno?t Minisini From gambas at ...1... Sat Aug 28 23:36:31 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sat, 28 Aug 2010 23:36:31 +0200 Subject: [Gambas-user] Question about collections and inheritance In-Reply-To: References: Message-ID: <201008282336.31332.gambas@...1...> > Hi all. > > I'm trying to code a very basic Xml Excel Generator, and I'm workin with > a collection. This is my code: > > ' Gambas class file > > Inherits Collection > > Public Function Add($ID As String) As Style > > Dim $style As New Style($ID) > > Super.Add($style, $ID) > > Return $style > > End > > Public Function _GetXml() As String > > Dim $style As Style > Dim $text As String = "\t\n" > > For Each $style In Me > $text &= $style._GetXml() & "\n" > Next > > $text &= "\t" > Return $text > > End > > Style is another class I have. My class inherits the Collection class > and I override the Add function. All of this works fine, my question is > about another Collection functionality: > > With a normal Collection we can do something like this: > > Dim $col As Collection > $col.Add("My value", "key") > Print *$col["key"]* > > I can access to my item whit his "key". How can I override this > functionality in my class, because Gambas return me a Variant data type > element and I want to return my own data type, my Style class. > > Thanks. > > P.S. Sorry my english, I trying to learn it but I'm still newbie > You have to override the _get() method. Something like that I presume: Public sub _get(Id As String) As Style Return Super[Id] End Regards, -- Beno?t Minisini From gambas.fr at ...626... Sat Aug 28 23:46:08 2010 From: gambas.fr at ...626... (Fabien Bodard) Date: Sat, 28 Aug 2010 23:46:08 +0200 Subject: [Gambas-user] Question about collections and inheritance In-Reply-To: <201008282336.31332.gambas@...1...> References: <201008282336.31332.gambas@...1...> Message-ID: public function _Get(id as string) as style ;-) Le 28 ao?t 2010 23:36, Beno?t Minisini a ?crit : >> ? ?Hi all. >> >> ? ?I'm trying to code a very basic Xml Excel Generator, and I'm workin with >> a collection. This is my code: >> >> ' Gambas class file >> >> Inherits Collection >> >> Public Function Add($ID As String) As Style >> >> ? Dim $style As New Style($ID) >> >> ? Super.Add($style, $ID) >> >> ? Return $style >> >> End >> >> Public Function _GetXml() As String >> >> ? Dim $style As Style >> ? Dim $text As String = "\t\n" >> >> ? For Each $style In Me >> ? ? $text &= $style._GetXml() & "\n" >> ? Next >> >> ? $text &= "\t" >> ? Return $text >> >> End >> >> ? ?Style is another class I have. My class inherits the Collection class >> and I override the Add function. All of this works fine, my question is >> about another Collection functionality: >> >> ? ? With a normal Collection we can do something like this: >> >> ? Dim $col As Collection >> ? $col.Add("My value", "key") >> ? Print *$col["key"]* >> >> ? ?I can access to my item whit his "key". How can I override this >> functionality in my class, because Gambas return me a Variant data type >> element and I want to return my own data type, my Style class. >> >> ? ?Thanks. >> >> P.S. Sorry my english, I trying to learn it but I'm still newbie >> > > You have to override the _get() method. Something like that I presume: > > Public sub _get(Id As String) As Style > > ?Return Super[Id] > > End > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > From rospolosco at ...152... Sun Aug 29 01:27:57 2010 From: rospolosco at ...152... (Stefano Palmeri) Date: Sun, 29 Aug 2010 01:27:57 +0200 Subject: [Gambas-user] Need help on Tabstrip In-Reply-To: <201008282205.28362.gambas@...1...> References: <201008281825.29431.rospolosco@...152...> <201008282205.28362.gambas@...1...> Message-ID: <201008290127.57316.rospolosco@...152...> Il sabato 28 agosto 2010 22:05:28 Beno?t Minisini ha scritto: > > Il sabato 28 agosto 2010 10:57:29 Reynaldi Jansen ha scritto: > > > Hello. > > > > > > I want to ask how to copy control in tab to another tab? > > > I have a tabstrip with textarea, and when user want new tab, i want it > > > create a new tab with textarea too inside the new tab... > > > I don't have any idea how to do this on gambas... > > > Sorry for a poor question :-( > > > > > > Thanks! > > > > Hi. I attached a little example. > > > > The GTK version is needed if you're under a 'gtk' desktop, but it works > > well even under qt. So the GTK version is the good one; it has two more > > lines of code because the NOT-gtk version crashes the Gambas IDE. Is it a > > bug, Benoit? > > I don't see any difference in the source code of both projects. Both work > as expected. Are you sure that you sent the good files? Sorry, I messed up things. Anyway the two lines are these: TabStrip1[TabStrip1.Count - 1].Text = "Tab " & (TabStrip1.Count - 1) TabStrip1.Index = TabStrip1.Count - 1 With gb.qt you *don't need* these two lines to create a 'New Tab' and put focus on it. It works perfectly. If you remove these two lines gb.qt still works, but gb.gtk crashes the IDE. Attached the fixed example. Try selecting gb.gtk and you get a crash, at least on my system. Gambas 2.20 Qt 3.3.8b Gtk 2.12.12 Saluti, Stefano -------------- next part -------------- A non-text attachment was scrubbed... Name: tabstrip-0.0.3.tar.gz Type: application/x-tgz Size: 8099 bytes Desc: not available URL: From trat50 at ...67... Sun Aug 29 01:49:49 2010 From: trat50 at ...67... (t rat) Date: Sat, 28 Aug 2010 23:49:49 +0000 Subject: [Gambas-user] To wish list... (Tom Harvey) (Beno?t Minisini) In-Reply-To: References: Message-ID: > > System.FirstDayOfWeek has been implemented in revision #3151. > > Regards, > > -- > Beno?t Minisini > > Thank you so much Beno?t, Tom Harvey From ian.roper at ...1974... Sun Aug 29 04:45:18 2010 From: ian.roper at ...1974... (Ian Roper) Date: Sun, 29 Aug 2010 10:45:18 +0800 Subject: [Gambas-user] A minor bug with TabStrip Control - GTK Message-ID: <1283049918.2807.70.camel@...1975...> Greetings all, I think I have found a minor bug with the TabStrip control where the Tabs remain 'invisible' when you toggle the visibility mode while it is in the foreground of another control. I could not find this bug listed anywhere - it may have already been fixed in V3. Gambas version used in testing 2.20. Issues only occurs with gb.gtk - gb.qt seems to be fine. [To Test set project properties to gb.gtk] I created a standard form with a: Gridview control TabStrip control Label control in the body of Tab[0] (to test visibility of controls in TabStrip body). Button I set the arrangement of the TabStrip control to - 'Bring To Foreground' in the GUI. The area of the Tabs in the TabStrip control must be over the background control. -------------------------------------------------------------------------------------- [Code used to display bug.] PUBLIC SUB Form_Open() TabStrip1.Visible = FALSE END PUBLIC SUB Button1_Click() TabStrip1.Visible = TRUE END -------------------------------------------------------------- When you click on Button1 the body of the TabStrip becomes visible - the label control in Tab[0] is visible. The tabs ( any number ) remain invisible provided they are over the background control. Note # If you add the line Gridview1.visible = FALSE to the Button1 Click event , the tabs of the TabStrip control are then visible at run time. I found that every control I tested as the background control ( Panel, Text box, Frame...) produced the same results as long as the Tabs were over the background control. Regards, Ian Roper Perth - Western Australia From reynaldi.jansen at ...626... Sun Aug 29 05:37:05 2010 From: reynaldi.jansen at ...626... (Reynaldi Jansen) Date: Sun, 29 Aug 2010 10:37:05 +0700 Subject: [Gambas-user] Need help on Tabstrip In-Reply-To: <201008290127.57316.rospolosco@...152...> References: <201008281825.29431.rospolosco@...152...> <201008282205.28362.gambas@...1...> <201008290127.57316.rospolosco@...152...> Message-ID: Yes i also get the same thing (hang) when remove the "two-lines" with gtk... Gambas 2.21... Anyway, thanks for your help Stefano! On Sun, Aug 29, 2010 at 6:27 AM, Stefano Palmeri wrote: > Il sabato 28 agosto 2010 22:05:28 Beno?t Minisini ha scritto: > > > Il sabato 28 agosto 2010 10:57:29 Reynaldi Jansen ha scritto: > > > > Hello. > > > > > > > > I want to ask how to copy control in tab to another tab? > > > > I have a tabstrip with textarea, and when user want new tab, i want > it > > > > create a new tab with textarea too inside the new tab... > > > > I don't have any idea how to do this on gambas... > > > > Sorry for a poor question :-( > > > > > > > > Thanks! > > > > > > Hi. I attached a little example. > > > > > > The GTK version is needed if you're under a 'gtk' desktop, but it works > > > well even under qt. So the GTK version is the good one; it has two more > > > lines of code because the NOT-gtk version crashes the Gambas IDE. Is it > a > > > bug, Benoit? > > > > I don't see any difference in the source code of both projects. Both work > > as expected. Are you sure that you sent the good files? > > Sorry, I messed up things. Anyway the two lines are these: > > TabStrip1[TabStrip1.Count - 1].Text = "Tab " & (TabStrip1.Count - 1) > TabStrip1.Index = TabStrip1.Count - 1 > > With gb.qt you *don't need* these two lines to create a 'New Tab' and put > focus on it. It works perfectly. > > If you remove these two lines gb.qt still works, but gb.gtk crashes the > IDE. > Attached the fixed example. Try selecting gb.gtk and you get a crash, at > least > on my system. > > Gambas 2.20 > Qt 3.3.8b > Gtk 2.12.12 > > Saluti, > > Stefano > > > > > > > > > > > > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > > From gambas at ...1... Sun Aug 29 13:50:09 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 29 Aug 2010 13:50:09 +0200 Subject: [Gambas-user] A minor bug with TabStrip Control - GTK In-Reply-To: <1283049918.2807.70.camel@...1975...> References: <1283049918.2807.70.camel@...1975...> Message-ID: <201008291350.09725.gambas@...1...> > Greetings all, > > I think I have found a minor bug with the TabStrip control where the > Tabs remain 'invisible' when you toggle the visibility mode while it is > in the foreground of another control. > I could not find this bug listed anywhere - it may have already been > fixed in V3. > > Gambas version used in testing 2.20. > Issues only occurs with gb.gtk - gb.qt seems to be fine. > > [To Test set project properties to gb.gtk] > > I created a standard form with a: > Gridview control > TabStrip control > Label control in the body of Tab[0] (to test visibility of controls in > TabStrip body). > Button > > I set the arrangement of the TabStrip control to - 'Bring To Foreground' > in the GUI. > > The area of the Tabs in the TabStrip control must be over the background > control. > > --------------------------------------------------------------------------- > ----------- [Code used to display bug.] > > PUBLIC SUB Form_Open() > TabStrip1.Visible = FALSE > END > > PUBLIC SUB Button1_Click() > > TabStrip1.Visible = TRUE > > END > -------------------------------------------------------------- > > When you click on Button1 the body of the TabStrip becomes visible - the > label control in Tab[0] is visible. > The tabs ( any number ) remain invisible provided they are over the > background control. > > Note # If you add the line Gridview1.visible = FALSE to the Button1 > Click event , the tabs of the TabStrip control are then visible at run > time. > > I found that every control I tested as the background control ( Panel, > Text box, Frame...) produced the same results as long as the Tabs were > over the background control. > > > Regards, > Ian Roper > Perth - Western Australia > > Please provide a little project, it will be far easier and safer for me to fix the bug! Thanks in advance. Regards, -- Beno?t Minisini From gambas at ...1... Sun Aug 29 14:01:26 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Sun, 29 Aug 2010 14:01:26 +0200 Subject: [Gambas-user] Need help on Tabstrip In-Reply-To: <201008290127.57316.rospolosco@...152...> References: <201008282205.28362.gambas@...1...> <201008290127.57316.rospolosco@...152...> Message-ID: <201008291401.26152.gambas@...1...> > Il sabato 28 agosto 2010 22:05:28 Beno?t Minisini ha scritto: > > > Il sabato 28 agosto 2010 10:57:29 Reynaldi Jansen ha scritto: > > > > Hello. > > > > > > > > I want to ask how to copy control in tab to another tab? > > > > I have a tabstrip with textarea, and when user want new tab, i want > > > > it create a new tab with textarea too inside the new tab... > > > > I don't have any idea how to do this on gambas... > > > > Sorry for a poor question :-( > > > > > > > > Thanks! > > > > > > Hi. I attached a little example. > > > > > > The GTK version is needed if you're under a 'gtk' desktop, but it works > > > well even under qt. So the GTK version is the good one; it has two more > > > lines of code because the NOT-gtk version crashes the Gambas IDE. Is it > > > a bug, Benoit? > > > > I don't see any difference in the source code of both projects. Both work > > as expected. Are you sure that you sent the good files? > > Sorry, I messed up things. Anyway the two lines are these: > > TabStrip1[TabStrip1.Count - 1].Text = "Tab " & (TabStrip1.Count - 1) > TabStrip1.Index = TabStrip1.Count - 1 > > With gb.qt you *don't need* these two lines to create a 'New Tab' and put > focus on it. It works perfectly. > > If you remove these two lines gb.qt still works, but gb.gtk crashes the > IDE. Attached the fixed example. Try selecting gb.gtk and you get a crash, > at least on my system. > > Gambas 2.20 > Qt 3.3.8b > Gtk 2.12.12 > > Saluti, > > Stefano Here is the explanation: When you create a TabStrip child, it is inserted in the current tab. Apparently, after having increased the Count property, gb.qt shows the last tab, whereas gb.gtk stays on the first tab. So when you browse the children of the first tab and insert a new TextArea, it is inserted there, and then you have one more child in the first tab. That new child is found in the next iteration of the browse loop, and so a new child is created again in the first tab, and so on, until no more control can be created. I fixed the bug in revision #3154. Regards, -- Beno?t Minisini From rospolosco at ...152... Sun Aug 29 15:32:41 2010 From: rospolosco at ...152... (Stefano Palmeri) Date: Sun, 29 Aug 2010 15:32:41 +0200 Subject: [Gambas-user] Need help on Tabstrip In-Reply-To: <201008291401.26152.gambas@...1...> References: <201008290127.57316.rospolosco@...152...> <201008291401.26152.gambas@...1...> Message-ID: <201008291532.41424.rospolosco@...152...> Il domenica 29 agosto 2010 14:01:26 Beno?t Minisini ha scritto: > > Il sabato 28 agosto 2010 22:05:28 Beno?t Minisini ha scritto: > > > > Il sabato 28 agosto 2010 10:57:29 Reynaldi Jansen ha scritto: > > > > > Hello. > > > > > > > > > > I want to ask how to copy control in tab to another tab? > > > > > I have a tabstrip with textarea, and when user want new tab, i want > > > > > it create a new tab with textarea too inside the new tab... > > > > > I don't have any idea how to do this on gambas... > > > > > Sorry for a poor question :-( > > > > > > > > > > Thanks! > > > > > > > > Hi. I attached a little example. > > > > > > > > The GTK version is needed if you're under a 'gtk' desktop, but it > > > > works well even under qt. So the GTK version is the good one; it has > > > > two more lines of code because the NOT-gtk version crashes the Gambas > > > > IDE. Is it a bug, Benoit? > > > > > > I don't see any difference in the source code of both projects. Both > > > work as expected. Are you sure that you sent the good files? > > > > Sorry, I messed up things. Anyway the two lines are these: > > > > TabStrip1[TabStrip1.Count - 1].Text = "Tab " & (TabStrip1.Count - 1) > > TabStrip1.Index = TabStrip1.Count - 1 > > > > With gb.qt you *don't need* these two lines to create a 'New Tab' and put > > focus on it. It works perfectly. > > > > If you remove these two lines gb.qt still works, but gb.gtk crashes the > > IDE. Attached the fixed example. Try selecting gb.gtk and you get a > > crash, at least on my system. > > > > Gambas 2.20 > > Qt 3.3.8b > > Gtk 2.12.12 > > > > Saluti, > > > > Stefano > > Here is the explanation: > > When you create a TabStrip child, it is inserted in the current tab. > > Apparently, after having increased the Count property, gb.qt shows the last > tab, whereas gb.gtk stays on the first tab. So when you browse the children > of the first tab and insert a new TextArea, it is inserted there, and then > you have one more child in the first tab. That new child is found in the > next iteration of the browse loop, and so a new child is created again in > the first tab, and so on, until no more control can be created. > > I fixed the bug in revision #3154. > > Regards, Well. Thanks for explanation. Stefano From robert1juhasz at ...626... Sun Aug 29 21:57:19 2010 From: robert1juhasz at ...626... (Robert JUHASZ) Date: Sun, 29 Aug 2010 21:57:19 +0200 Subject: [Gambas-user] TableView issue Message-ID: Hello List, I found a strange behavior of the tableview control. I use Gambas 2.20, qt, on ubuntu 10.04. I try to create an editable table. As long as I use only text input, it works fine. As long as I use lists or text and list but with unprotected (readonly=false, as by default) lists, it works fine. In this case I can use the arrows to move up and down, left and right. It is very comfortable. As long as I use protected lists (readonly=true) it works fine as well, except that I cannot move left and right with the arrows. It is less comfortable but still okay. The problem comes when I use some columns with protected and some others with unprotected lists. In this case, when I use the arrows for moving horizontally and I move from an unprotected cell to a protected one, it crashes the code with an error message about the combo box. If I was not clear then take the attached code, select a cell and move by pressing the arrows. The middle column is "unprotected". Can someone tell me if it's a bug or what should I do different? Thx, Robi -------------- next part -------------- A non-text attachment was scrubbed... Name: tableView-0.0.1.tar.gz Type: application/x-gzip Size: 7787 bytes Desc: not available URL: From rterry at ...1946... Mon Aug 30 13:42:43 2010 From: rterry at ...1946... (richard terry) Date: Mon, 30 Aug 2010 21:42:43 +1000 Subject: [Gambas-user] Rollling back a verison Message-ID: <201008302142.43352.rterry@...1946...> Any idea's how to do this. I updated the svn today and since then some major parts of my code won't work, though the logic in those files has not been touched for months. Any help appreciated 1) How to identify current svn version 2) How to select an arbitary version and roll back. Regards Richard From gambas at ...1... Mon Aug 30 13:52:29 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 30 Aug 2010 13:52:29 +0200 Subject: [Gambas-user] Rollling back a verison In-Reply-To: <201008302142.43352.rterry@...1946...> References: <201008302142.43352.rterry@...1946...> Message-ID: <201008301352.29731.gambas@...1...> > Any idea's how to do this. > > I updated the svn today and since then some major parts of my code won't > work, though the logic in those files has not been touched for months. > > Any help appreciated > 1) How to identify current svn version 'svn info https://gambas.svn.sourceforge.net/svnroot/gambas/gambas/trunk' will give you information on the gambas repository. 'svn info' will give you information about the current directory. Note that there is no "current version" of your local repository, as each directory and each file can come from a different repository version. > 2) How to select an arbitary version and roll back. 'svn update -r REVISION' Note that you may have conflicts, as with 'svn update'. If you want to come from a fresh repository, you can do a checkout too by specifying the revision number. 'svn help COMMAND' can be useful too. Regards, -- Beno?t Minisini From gambas at ...1... Mon Aug 30 13:56:39 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 30 Aug 2010 13:56:39 +0200 Subject: [Gambas-user] A minor bug with TabStrip Control - GTK In-Reply-To: <201008291350.09725.gambas@...1...> References: <1283049918.2807.70.camel@...1975...> <201008291350.09725.gambas@...1...> Message-ID: <201008301356.39512.gambas@...1...> > > Greetings all, > > > > I think I have found a minor bug with the TabStrip control where the > > Tabs remain 'invisible' when you toggle the visibility mode while it is > > in the foreground of another control. > > I could not find this bug listed anywhere - it may have already been > > fixed in V3. > > > > Gambas version used in testing 2.20. > > Issues only occurs with gb.gtk - gb.qt seems to be fine. > > > > [To Test set project properties to gb.gtk] > > > > I created a standard form with a: > > Gridview control > > TabStrip control > > Label control in the body of Tab[0] (to test visibility of controls in > > TabStrip body). > > Button > > > > I set the arrangement of the TabStrip control to - 'Bring To Foreground' > > in the GUI. > > > > The area of the Tabs in the TabStrip control must be over the background > > control. > > > > ------------------------------------------------------------------------- > > -- ----------- [Code used to display bug.] > > > > PUBLIC SUB Form_Open() > > TabStrip1.Visible = FALSE > > END > > > > PUBLIC SUB Button1_Click() > > > > TabStrip1.Visible = TRUE > > > > END > > -------------------------------------------------------------- > > > > When you click on Button1 the body of the TabStrip becomes visible - the > > label control in Tab[0] is visible. > > The tabs ( any number ) remain invisible provided they are over the > > background control. > > > > Note # If you add the line Gridview1.visible = FALSE to the Button1 > > Click event , the tabs of the TabStrip control are then visible at run > > time. > > > > I found that every control I tested as the background control ( Panel, > > Text box, Frame...) produced the same results as long as the Tabs were > > over the background control. > > > > > > Regards, > > Ian Roper > > Perth - Western Australia > > Please provide a little project, it will be far easier and safer for me to > fix the bug! > > Thanks in advance. > > Regards, OK. I could reproduce the bug anyway. Very strange indeed... -- Beno?t Minisini From gambas at ...1... Mon Aug 30 15:02:35 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 30 Aug 2010 15:02:35 +0200 Subject: [Gambas-user] A minor bug with TabStrip Control - GTK In-Reply-To: <1283049918.2807.70.camel@...1975...> References: <1283049918.2807.70.camel@...1975...> Message-ID: <201008301502.35624.gambas@...1...> > Greetings all, > > I think I have found a minor bug with the TabStrip control where the > Tabs remain 'invisible' when you toggle the visibility mode while it is > in the foreground of another control. > I could not find this bug listed anywhere - it may have already been > fixed in V3. > > Gambas version used in testing 2.20. > Issues only occurs with gb.gtk - gb.qt seems to be fine. > > [To Test set project properties to gb.gtk] > > I created a standard form with a: > Gridview control > TabStrip control > Label control in the body of Tab[0] (to test visibility of controls in > TabStrip body). > Button > > I set the arrangement of the TabStrip control to - 'Bring To Foreground' > in the GUI. > > The area of the Tabs in the TabStrip control must be over the background > control. > > --------------------------------------------------------------------------- > ----------- [Code used to display bug.] > > PUBLIC SUB Form_Open() > TabStrip1.Visible = FALSE > END > > PUBLIC SUB Button1_Click() > > TabStrip1.Visible = TRUE > > END > -------------------------------------------------------------- > > When you click on Button1 the body of the TabStrip becomes visible - the > label control in Tab[0] is visible. > The tabs ( any number ) remain invisible provided they are over the > background control. > > Note # If you add the line Gridview1.visible = FALSE to the Button1 > Click event , the tabs of the TabStrip control are then visible at run > time. > > I found that every control I tested as the background control ( Panel, > Text box, Frame...) produced the same results as long as the Tabs were > over the background control. > > > Regards, > Ian Roper > Perth - Western Australia > > The bug is fixed in revison #3161 if you want to test. Regards, -- Beno?t Minisini From gambas at ...1... Mon Aug 30 15:14:24 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 30 Aug 2010 15:14:24 +0200 Subject: [Gambas-user] TableView issue In-Reply-To: References: Message-ID: <201008301514.24979.gambas@...1...> > Hello List, > > I found a strange behavior of the tableview control. I use Gambas 2.20, qt, > on ubuntu 10.04. > > I try to create an editable table. > As long as I use only text input, it works fine. > As long as I use lists or text and list but with unprotected > (readonly=false, as by default) lists, it works fine. In this case I can > use the arrows to move up and down, left and right. It is very > comfortable. As long as I use protected lists (readonly=true) it works > fine as well, except that I cannot move left and right with the arrows. It > is less comfortable but still okay. > > The problem comes when I use some columns with protected and some others > with unprotected lists. > In this case, when I use the arrows for moving horizontally and I move from > an unprotected cell to a protected one, it crashes the code with an error > message about the combo box. > > If I was not clear then take the attached code, select a cell and move by > pressing the arrows. The middle column is "unprotected". > > > Can someone tell me if it's a bug or what should I do different? > > Thx, > Robi This was a bug! Can you try the revision #3162 to tell me if it works better for you? -- Beno?t Minisini From gambas at ...1... Mon Aug 30 16:46:13 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 30 Aug 2010 16:46:13 +0200 Subject: [Gambas-user] TableView issue In-Reply-To: <201008301514.24979.gambas@...1...> References: <201008301514.24979.gambas@...1...> Message-ID: <201008301646.14018.gambas@...1...> > > Hello List, > > > > I found a strange behavior of the tableview control. I use Gambas 2.20, > > qt, on ubuntu 10.04. > > > > I try to create an editable table. > > As long as I use only text input, it works fine. > > As long as I use lists or text and list but with unprotected > > (readonly=false, as by default) lists, it works fine. In this case I can > > use the arrows to move up and down, left and right. It is very > > comfortable. As long as I use protected lists (readonly=true) it works > > fine as well, except that I cannot move left and right with the arrows. > > It is less comfortable but still okay. > > > > The problem comes when I use some columns with protected and some others > > with unprotected lists. > > In this case, when I use the arrows for moving horizontally and I move > > from an unprotected cell to a protected one, it crashes the code with an > > error message about the combo box. > > > > If I was not clear then take the attached code, select a cell and move by > > pressing the arrows. The middle column is "unprotected". > > > > > > Can someone tell me if it's a bug or what should I do different? > > > > Thx, > > Robi > > This was a bug! Can you try the revision #3162 to tell me if it works > better for you? No, try revision #3164 instead, it is better. :-) -- Beno?t Minisini From lord.quo at ...626... Mon Aug 30 16:58:17 2010 From: lord.quo at ...626... (Lord Quo) Date: Mon, 30 Aug 2010 09:58:17 -0500 Subject: [Gambas-user] Question about collections and inheritance In-Reply-To: <201008282336.31332.gambas@...1...> References: <201008282336.31332.gambas@...1...> Message-ID: <81073FA4EE5B4D2295BAC46633D56774@...2471...> Excellent! Thans :-) -------------------------------------------------- From: "Beno?t Minisini" Sent: Saturday, August 28, 2010 4:36 PM To: "mailing list for gambas users" Subject: Re: [Gambas-user] Question about collections and inheritance >> Hi all. >> >> I'm trying to code a very basic Xml Excel Generator, and I'm workin >> with >> a collection. This is my code: >> >> ' Gambas class file >> >> Inherits Collection >> >> Public Function Add($ID As String) As Style >> >> Dim $style As New Style($ID) >> >> Super.Add($style, $ID) >> >> Return $style >> >> End >> >> Public Function _GetXml() As String >> >> Dim $style As Style >> Dim $text As String = "\t\n" >> >> For Each $style In Me >> $text &= $style._GetXml() & "\n" >> Next >> >> $text &= "\t" >> Return $text >> >> End >> >> Style is another class I have. My class inherits the Collection class >> and I override the Add function. All of this works fine, my question is >> about another Collection functionality: >> >> With a normal Collection we can do something like this: >> >> Dim $col As Collection >> $col.Add("My value", "key") >> Print *$col["key"]* >> >> I can access to my item whit his "key". How can I override this >> functionality in my class, because Gambas return me a Variant data type >> element and I want to return my own data type, my Style class. >> >> Thanks. >> >> P.S. Sorry my english, I trying to learn it but I'm still newbie >> > > You have to override the _get() method. Something like that I presume: > > Public sub _get(Id As String) As Style > > Return Super[Id] > > End > > Regards, > > -- > Beno?t Minisini From lord.quo at ...626... Mon Aug 30 16:59:01 2010 From: lord.quo at ...626... (Lord Quo) Date: Mon, 30 Aug 2010 09:59:01 -0500 Subject: [Gambas-user] Question about collections and inheritance In-Reply-To: References: <201008282336.31332.gambas@...1...> Message-ID: <995993F0960A485D82C2DDDE07F6F779@...2471...> :-) It's correct. Many thanks. -------------------------------------------------- From: "Fabien Bodard" Sent: Saturday, August 28, 2010 4:46 PM To: "mailing list for gambas users" Subject: Re: [Gambas-user] Question about collections and inheritance > public function _Get(id as string) as style ;-) > > Le 28 ao?t 2010 23:36, Beno?t Minisini a > ?crit : >> Public sub _get(Id As String) As Style >> >> Return Super[Id] >> >> End >> >> Regards, >> >> -- >> Beno?t Minisini From gambas at ...1... Mon Aug 30 19:06:52 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Mon, 30 Aug 2010 19:06:52 +0200 Subject: [Gambas-user] Extern howto/tutorial In-Reply-To: <4C78B541.8000402@...1909...> References: <201008252212.14249.gambas@...1...> <4C78B541.8000402@...1909...> Message-ID: <201008301906.52890.gambas@...1...> > Beno?t Minisini ha scritto: > >> Beno?t Minisini ha scritto: > > No: there is no HTML at all in your mail. > > Very strange. A friend of us picked the same document from the gambas > list, and put it on the italian site of gambas (www.gambas-it.org). > Anyway, I attach a tarred copy of the new document, which contains > corrections. Thanks. I have put in on gambasdoc.org. > > My copy of the documentation is different. With all evidence, a > correction about this topic was added after I downloaded the gambas > sources from sourceforge. Anyway, the important thing is that now the > documentation is correct. Ha! I have forgotten you are using an offline copy of the documentation. > > > Note that 'WRITE #p, 0, 1' does not write one byte, but only the integer > > 0 on four bytes. You must do 'WRITE #p, chr$(0), 1' > > > > WRITE #p, outq writes four bytes as outq is an integer, not one byte. > > > > And so on... I think you must check all your use of the WRITE > > instruction, which write a number of bytes that depends on the datatype > > of its second argument. > > I corrected the above errors, and attach the revised project. > It worked anyway, because the extraneous bytes written after the > intended ones, were afterwards rewritten with correct values. Perhaps > the compiler could reject statements like "write #p, 0, 1", or perhaps > gambas2 is going to museum in favor of gambas3. > > In a previous email I said that by declaring a constant as a byte, and > then writing it out with a "write #pointer...", 4 bytes were written > instead of one. This is not totally true - I did'nt verified. What is > true, instead, is that declaring a constant as byte, and then writing it > out to a stream, 4 bytes are written. This was verified in an old > temptative of the drum machine, where OSS was used instead of alsa, and > a gambas stream (file) was used to write to the file /dev/sequencer2. > That is a bug, but I thought I have fixed it. I must check again then... Regards, -- Beno?t Minisini From prog at ...2177... Tue Aug 31 03:12:58 2010 From: prog at ...2177... (craf) Date: Mon, 30 Aug 2010 21:12:58 -0400 Subject: [Gambas-user] Devel List Message-ID: <1283217178.6992.1.camel@...2406...> Hi. The Devel list is working? Regards. From prog at ...2177... Tue Aug 31 03:49:54 2010 From: prog at ...2177... (craf) Date: Mon, 30 Aug 2010 21:49:54 -0400 Subject: [Gambas-user] Email. Message-ID: <1283219394.6992.2.camel@...2406...> Hi Benoit You have a particular email address to send a code? Regards. Cristian Abarz?a From gambas at ...1... Tue Aug 31 03:54:00 2010 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Tue, 31 Aug 2010 03:54:00 +0200 Subject: [Gambas-user] Email. In-Reply-To: <1283219394.6992.2.camel@...2406...> References: <1283219394.6992.2.camel@...2406...> Message-ID: <201008310354.00189.gambas@...1...> > Hi Benoit > > You have a particular email address to send a code? > > Regards. > > Cristian Abarz?a > > The one I use to post on this list! -- Beno?t Minisini From fabianfloresvadell at ...626... Tue Aug 31 22:50:45 2010 From: fabianfloresvadell at ...626... (=?ISO-8859-1?Q?Fabi=E1n_Flores_Vadell?=) Date: Tue, 31 Aug 2010 17:50:45 -0300 Subject: [Gambas-user] Controls by code are invisible in Gnome Message-ID: I was testing a custom control in a Ubuntu 9.10 virtualized by VirtualBox (using Gambas 2.18), and my controls become invisible in execution time. This not happens on Kubuntu 10.04 on virtualbox too (using Gambas 2.20). I was suprized when I verified that the same happens with controls provided by Gambas, What's could be happening? 'lbl1 is invisible in time execution PUBLIC SUB _new() DIM lbl1 AS NEW Label(ME) lbl1.Text = "Hi people" END -- Fabi?n Flores Vadell www.speedbooksargentina.blogspot.com