Re: [Gambas-user] Reading control properties from a collection
Marty, Never a good idea to dirty your fingers poking a form's controls from another one. Been there, done that, regretted it for a long time. I'd do this instead, and it's a general-purpose approach that served me well for a long time, no matter the cross-forms (or even cross-class) data you need: In the form (call it *frmA*) that has the data the other form (call it *frmB*) needs, I'd publish the necessary data as appropriate type's *Public Property*(*ies*). I would also -if necessary- set up some kind of *Event* in *frmA* that triggers when the sought data changes. Then, in *frmB*, I'd *Dim* a *Private* *Object* of type *frmA* and instance and show it whenever necessary. In *frmB*'s event handler for *frmA*'s event -or in code, your call- I'd check the *Public Property*(*ies*) of *frmA*. Doing it this way not only isolates your data access from the underlying implementation, but also you can radically change HOW you access data to be published in *frmA* while not touching *frmB* at all. Then, you may fetch data in *frmA* from a database, flat file or TCP socket, and *frmB* will function the same, no code mods necessary. An additional advantage is no time wasted on for-loops. HTH, zxMarce. *On 14/Apr/2015 11:00, Martin McGlensey wrote:* Hello, I have a form that contains a named datasource. I want to read the name and table properties of that datasource from another form. Both forms are visible. I've used the loop "For each hWindow in Windows" to test to see if the form is visible. If it is I cycle through the control collection for that form till I find an Object.Type = "DataSource". So far so good - I can find the datasource and assign it to a variant variable (DataTable). Now if I do strX = DataTable.Name it returns "DataSource1" instead of "Neighborhood" the name of the datasource on the form containing the collection. I want to get to the datasource name and table from the first form. They should be name=neighborhood and table=tblneighborhood. If I assign frmEntry.Neighborhood to datatable on the second form then I get the correct data returned. I think it should be possible to get this data from the forms collection but, I have not figured out how. So can it be done and if so how? Regards, Marty -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Gambas-user Digest, Vol 107, Issue 12
Marty, First off, sorry for the delay. I made a how-to example, but I'd prefer to also post it to the list so everybody else can benefit from it. Please find it attached. Loads of comments, little code. It's really surprising (and relieving) to see how easy it actually is! Please check not only the comments in code, but the project description as well. As a side note, I'd like to ask the mods -if appropriate- to include it in the How To wiki (or anywhere else they seem adequate). Inter-class data passing is easy to implement, but there is a lack of examples in the Wiki and Help. Moreover the event sink routine naming scheme is a bit obscure but obvious once you figure it out, yet no examples found in the official docs. HTH, zxMarce. *On 15/Apr/2015 09:08, Martin McGlensey wrote:* > Marce, > Appreciate your suggestion. But, I'm totally confused by your explanation. I > do not know how to implement it. Could you provide an example? Send it as an > attachment to n3...@arrl.net. That way I'll get it. The intent is to read the > datasource.table property on form A for use in form B and to assign the > datasource to a datasource object on form B. No changes need be made to the > datasource properties on form A. > Marty > > *Message: 1 > Date: Tue, 14 Apr 2015 11:48:02 -0300 > From: ML > Subject: Re: [Gambas-user] Reading control properties from a collection > To: mailing list for gambas users > Message-ID: <552d28a2.8040...@gmail.com> > Content-Type: text/plain; charset=windows-1252 > *Marty, > Never a good idea to dirty your fingers poking a form's controls from another > one. Been there, done that, regretted it for a long time. > I'd do this instead, and it's a general-purpose approach that served me well > for a long time, no matter the cross-forms (or even cross-class) data you > need: > In the form (call it *frmA*) that has the data the other form (call it > *frmB*) needs, I'd publish the necessary data as appropriate type's *Public > Property*(*ies*). > I would also -if necessary- set up some kind of *Event* in *frmA* that > triggers when the sought data changes. > Then, in *frmB*, I'd *Dim* a *Private* *Object* of type *frmA* and instance > and show it whenever necessary. > In *frmB*'s event handler for *frmA*'s event -or in code, your call- I'd > check the *Public Property*(*ies*) of *frmA*. Doing it this way not only > isolates your data access from the underlying implementation, but also you > can radically change HOW you access data to be published in *frmA* while not > touching *frmB* at all. > Then, you may fetch data in *frmA* from a database, flat file or TCP socket, > and *frmB* will function the same, no code mods necessary. An additional > advantage is no time wasted on for-loops. > HTH, > zxMarce. > > *On 14/Apr/2015 11:00, Martin McGlensey wrote:* Hello, I have a form that > contains a named datasource. I want to read the name and table properties of > that datasource from another form. Both forms are visible. > I've used the loop "For each hWindow in Windows" to test to see if the form > is visible. If it is I cycle through the control collection for that form > till I find an Object.Type = "DataSource". So far so good - I can find the > datasource and assign it to a variant variable (DataTable). > Now if I do strX = DataTable.Name it returns "DataSource1" instead of > "Neighborhood" the name of the datasource on the form containing the > collection. > I want to get to the datasource name and table from the first form. They > should be name=neighborhood and table=tblneighborhood. If I assign > frmEntry.Neighborhood to datatable on the second form then I get the correct > data returned. I think it should be possible to get this data from the forms > collection but, I have not figured out how. > So can it be done and if so how? > Regards, > Marty GetDataFromAnotherForm.tar.gz Description: application/gzip -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] R: How to know is my Form activated or not?
Abbat, I'd go like this instead: * Private _active As Boolean = False** 'This private form variable will hold the form's state ** Public Property Read IsActive As Boolean 'This property will return the private variable value** ** Private Function IsActive_Read() As Boolean 'The function declaration for reading the property** **Return _active ' the current form state is returned** ** End** ** Public Sub Form_Activate() 'This sub will change the **private variable value to Active. **_active = True** ' flag the state as Active. ** End** ** Public Sub Form_Deactivate()** 'This sub will change the **private variable value to Inactive.** **_active = False**' flag the state as Inactive.** ** End* >From any other form, module or class you can now check the new *IsActive* form property: * Dim myForm As New frmWithProperty 'Assume frmWithProperty has the above property code [... code ...] ** If myForm.IsActive Then [... code for when the form is active...] Else **[... code for when the form is not active...] Endif [... even more code ...]* The property can be added the same way to a single, some, or all forms in the project. Regards, *On 05/02/2015 01:24 PM, Ru Vuott wrote:* > If you know visible-name of Form, you could use (gb.Desktop): > Public Sub Button1_Click() > Dim dw As DesktopWindow >For Each dw In Desktop.Windows > ' If the visible-name is the same as the name of the form that we seek, then > it detects that: > If dw.VisibleName = "visible-name of Form" then Print "Form is active !" > >Next > End > > > *Sab 2/5/15, abbat81 ha scritto:* > Oggetto: [Gambas-user] How to know is my Form activated or not? > A: gambas-user@lists.sourceforge.net > Data: Sabato 2 maggio 2015, 13:43 > In Event I use *Form_Activate()* and > *Form_Deactivate()* > But I need to have boolean Y/N when I ask. > -- > View this message in context: > http://gambas.8142.n7.nabble.com/How-to-know-is-my-Form-activated-or-not-tp51426.html > Sent from the gambas-user mailing list archive at Nabble.com. > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] R: How to know is my Form activated or not?
Fabien, Thanks for the clarification. Actually, as an old-time VB6 and more recently VBNet and Gambas developer, I tend to use camel-case and actually dropped the *b*/Boolean, *l*/Long, *s*/String, etc prefixes not long ago. Also, I normally used to go *m_* for a module (local to the class) variable in VB6. But I found that Gambas can happily use the underscore without the "*m*" prefix, just as in VBNet. And, as an even older-time Sinclair Basic user, I tend to reserve the *$* sign for string suffixes :P Somehow it just looks strange to me to use the *$* as a prefix! Anyway, I don't quite understand what you mean by "Private Global"; to me it's either Private or Global, but not both. What I do is use a Private variable to hold a value that I will publish later via a Public Property. But the variable itself is Private while the Property is Public. I do make that distinction. And, as you say, the private variable is hidden by the IDE, so the only way to access it is via the property, which is the original intention. Nonetheless, I will try to remember and adhere to your specs if I give further examples to the list. Regards, *On 05/02/2015 05:35 PM, Fabien Bodard wrote:* > *2015-05-02 20:51 GMT+02:00 ML :* >> Abbat, >> >> I'd go like this instead: >> >> * Private _active As Boolean = False** 'This private form >> variable will hold the form's state >> ** Public Property Read IsActive As Boolean 'This property will >> return the private variable value** >> >> ** Private Function IsActive_Read() As Boolean 'The function >> declaration for reading the property** >> **Return _active ' the current form >> state is returned** >> ** End** >> ** >> Public Sub Form_Activate() 'This sub will change the >> **private variable value to Active. >> **_active = True** ' flag the state as >> Active. >> ** End** >> ** >> Public Sub Form_Deactivate()** 'This sub will change >> the **private variable value to Inactive.** >> **_active = False**' flag the state as >> Inactive.** >> ** End* >> >> >From any other form, module or class you can now check the new >> *IsActive* form property: >> >> * Dim myForm As New frmWithProperty 'Assume frmWithProperty has the >> above property code >> [... code ...] >> ** If myForm.IsActive Then >> [... code for when the form is active...] >> Else >> **[... code for when the form is not active...] >> Endif >> [... even more code ...]* >> >> The property can be added the same way to a single, some, or all forms >> in the project. >> >> Regards, > To informate > > By convention : > > > Private $bIsActive as Boolean > > > $ = Private globale > b = boolean > > _ = hidden public Property Variable or Procedure. > > The Ide hide the Names beginning by '_' > > -- > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] R: How to know is my Form activated or not?
Abbat, I don't know if you got my reply to the list. I'd go like this instead (this is code to add to the form(s) you want to check): * Private $bActive As Boolean = False** 'This private form variable will hold the form's state ** Public Property Read IsActive As Boolean 'This property will return the private variable value** ** Private Function IsActive_Read() As Boolean 'The function declaration for reading the property** **Return ***$bActive * ' the current form state is returned** ** End** ** Public Sub Form_Activate() 'This sub will change the **private variable value to Active. ****$bActive = True** ' flag the state as Active. ** End** ** Public Sub Form_Deactivate()** 'This sub will change the **private variable value to Inactive. ****$bActive**= False** ' flag the state as Inactive.** ** End* This works as follows: When you initially instance the form, the private variable *$bActive* is set to FALSE. When the form is activated, the *Form_Activate* event triggers and sets the private variable *$bActive* as TRUE; when the form is deactivated, the *Form_Deactivate* event triggers and sets the *$bActive* variable to FALSE. At any time, code external to the form can check the new form property *IsActive* to find out if the form is active or not. This new property will return the value TRUE or FALSE that has been set to the *$bActive*** variable. External code can check the new *IsActive* form property as follows: * Dim myForm As New frmWithProperty 'frmWithProperty is a form with the above new property code included [... code ...] ** If myForm.IsActive Then [... code for when the form is active...] Else **[... code for when the form is not active...] Endif [... even more code ...]* The property can be added the same way to a single, some, or all forms in the project. Regards, zxMarce. *On 04/May/2015 09:24, abbat81 wrote:* > Dim dw As DesktopWindow >For Each dw In Desktop.Windows > Print "_" & dw.VisibleName >Next > > I got next: > > _ > _ > _ > _ > _ > _ > _ > _ > _ > _ > _ > _ > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Question
If I'm correct, it means that the compiler should take the specified string as an identifier and not as a reserved word or class. In this case, the string is 'Map'. Looks like the Map property ("{Map}") returns a Map (As Map) object. Sneaky! On 2015-09-29 12:26, Moviga Technologies wrote: > Property Read {Map} As Map > > What are the brackets doing? -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] New gb.web.form component
*On 11/14/2015 12:29 PM, Benoît Minisini wrote:* > *Le 14/11/2015 16:18, Moviga Technologies a écrit :* >> Haha! I am laughing! :D That's a good reason! >> My condolences to you by the way. It is very sad to see what has >> happened. Do you live in Paris? > Yep. > As I said to a friend, the "great" leaders of our "free" world were > thinking about giving antitank rockets to the "moderate" terrorists just > a week ago to pester the russians. What a beautiful firework they could > do in Paris with that. The number of deaths record will be beaten > easily. :-( Benoît, GLAD to hear (read?) that you're OK after looking open-mouthed to the yellowish news. Also, my condolences to you on the brutal nonsense. (as usual in our local news, they found an argentine "survivor" whom they gave plenty of airtime) I did not abandon ODBC, by the way, just sharpening my C. Ok back on topic. I have 3.8.3. Out of curiosity after reading this thread I wanted to create a web project. I did, and ran it. A Firefox opened with all the environment values in a nice table. But I could not find anywhere a place to add a new form. How do I add a Form in a web app? Or am I talking my usual nonsense? Regards, An alleviated zxMarce. -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] how print each char/possition in string including spaces
Gerardo, I think you speak spanish, I've been to your site. I'll switch to ES-AR. If I'm wrong, then please accept my apologies, tell me, and I'll repost in US-EN. Tenés que iterar con un FOR-NEXT teniendo en cuenta la longitud del string. Por ejemplo, pon esto en FORM_OPEN: Dim myString As String = "Hello" Dim pointer As Integer = 0 For pointer = 1 To Len(myString) 'Esto será MUY molesto, pero sirve para ejemplo. Además myString no es muy largo... ;) Message.Info("Caracter en posición " & Str(pointer) & " es '" & Mid(myString, pointer, 1) & "'.") Next El primer caracter en strings en Gambas tiene índice 1. Saludos. *On 2015-12-10 14:39, PICCORO McKAY Lenz wrote:* > of the chari have a String "var1" = "this its a string" > > how can i print each position/char of the string including the spaces! > > Lenz McKAY Gerardo (PICCORO) > http://qgqlochekone.blogspot.com > > -- > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] how print each char/possition in string including spaces
On 2015-12-10 15:23, Benoît Minisini wrote: > Le 10/12/2015 19:19, PICCORO McKAY Lenz a écrit : >> 2015-12-10 13:21 GMT-04:30 ML : >>> Gerardo, >>> >>> I think you speak spanish, I've been to your site. I'll switch to ES-AR. >> YEAH, the mail report correct! >>> If I'm wrong, then please accept my apologies, tell me, and I'll repost >>> in US-EN. >> i'll paste also in US due for others if are need later when we resolved >>> Tenés que iterar con un FOR-NEXT teniendo en cuenta la longitud del >>> string. Por ejemplo, pon esto en FORM_OPEN: >> YA lo hice, pero el puerto serial (no se como ponerl e inxluso en el >> texto en ingles no lo puse) el puerto serial creo solo puede devolver >> 8 bits >> >> Para que tengas una idea, en argentina se emplean impresoras fiscales, >> y estas devuelven data (todas devuelven distinta data), pero como el >> serial solo devuelve un byte de 8 gits (creo es asi) es decir una sola >> palabra, por tanto la impresora "pica" el resultado en dos partes, ese >> es el primer problema >> >> El segundo problema es que la salida son realmente codigos ascii ejemplo: >> "0" >> que es : >> "^B^C^C^C^A^A0 >> ^A^C^F" >> En la primera no se ve nada porque son caracteres no imprimibles, pero >> en geany se pueden ver los caracteres ocultos y en un textbox, la >> segunda es lo que Print de gambas imprime en la cosola y que vez en la >> tabla ascii >> >> alguna idea? la que tengo es imprimir cada caracter imprimible, pero >> no puedo hacer split por el "^" porque a veces devuelve un caracter >> extrano entre estos (todos los kit fiscales lo hacen) >>>Dim myString As String = "Hello" >>>Dim pointer As Integer = 0 >>>For pointer = 1 To Len(myString) >>> 'Esto será MUY molesto, pero sirve para ejemplo. Además myString no es >>> muy largo... ;) >>> Message.Info("Caracter en posición " & Str(pointer) & " es '" & >>> Mid(myString, pointer, 1) & "'.") >>>Next >>> El primer caracter en strings en Gambas tiene índice 1. >>> Saludos. >>> >>> *On 2015-12-10 14:39, PICCORO McKAY Lenz wrote:* >>>> of the chari have a String "var1" = "this its a string" >>>> how can i print each position/char of the string including the spaces! >>>> Lenz McKAY Gerardo (PICCORO) >>>> http://qgqlochekone.blogspot.com >>>> > Please use english on the mailing-list. It's not that I love that > language, but it's the current "lingua franca" that allows everyone to > understand the mails! > Regards, Sorry, Benoît. I thought the question was simple enough and tried to make it even simpler by switching language. Gerardo, I know what you mean. Point is, ASCII has printable and non-printable characters. Printable characters are ALWAYS in the &H20 to &H7F range. Anything below &H20 not only is non-printable but also normally used as control characters. Anything above &H7F may or may not print. For example take newline or LineFeed. ASCII code &H0A. Non-printable, but in Linux -and Gambas- you can refer to it as "\n". You can think of the "^" prefix like subtracting &H40 from the next character's ASCII code. What you see as "^A" (analogous to Ctrl-A in the keyboard) refers to ASCII control code SOH (ASCII &H01). It comes from ASC("A") - &H40 = 1: The old teletype CONTROL keys just resetted bit 6 (value is 64, or &H40) of the character key pressed with it. I'm sure you saw "^[" when you press Escape in some (console) programs: ASC("[") - &H40 = &H1B (ASCII ESC). The double-character combination you see is the OS's best effort to make printable something that is not. Try this in Gambas: Dim myString As String = Chr$(27) 'Escape, char &H1B Message.Info("Character '" & myString & "', ASCII code: " & Asc(myString)) myString = "\n" 'Linefeed, char (ASCII &H0A) Message.Info("Character '" & myString & "', ASCII code: " & Asc(myString)) Remember that ASC will only return the ASCII code of the FIRST character in a string. If you need several, you will have to use a loop. I also made Fiscal Printer Drivers. Under my belt are at least Venezuela, Bulgaria, Chile, Panama, Argentina, and even Russia. They are ALL a freaking pain in the lower back, and there are few -if any- standards, as they all depend on crazy laws made by crazier people. Bad news, I made them all in Win/VB6 for my company. Advantage of VB in these cases is the existence of Win-libraries. I never used serial ports in Gambas. I can give it a try, though. But will have to be at least tomorrow. Hope that helped, zxMarce. -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] [Gambas Bug Tracker] Bug #876: please return the edit menu to root (cut, copy, paste)
Gerardo, You may use the "standard" keyboard shortcuts instead: *COPY -> Ctrl-C** **PASTE -> Ctrl-V** **CUT -> Ctrl-X* Or the "more international" shortcuts (because they do not depend on specific letters); I use these since the old QuickBasic 4.5 (DOS) days: *COPY -> Ctrl-Ins** **PASTE -> Shift-Ins** **CUT -> Shift-Del* If I remember correctly, they work in both, code and form editors in Gambas. I hardly use the Ctrl-X/C/V combinations, ever! Regards, *On 2015-12-18 10:26, bugtrac...@gambaswiki.org wrote:* > http://gambaswiki.org/bugtracker/edit?object=BUG.876&from=L21haW4- > > PICCORO LENZ MCKAY reported a new bug. > > Summary > --- > please return the edit menu to root (cut, copy, paste) > Type : Request > Priority : High > Gambas version : 3.8 > Product : Development Environment > > > Description > --- > currently in editor the editing menu to cut, copy or paste a portion > of text are in a submenu.. > please can return these items to the root menu event in a sub menu? > for fast-development are more satisfactory! especial for users of > other languages! > > System information > -- > [System] > Gambas=3.8.3 > OperatingSystem=Linux > Kernel=4.2.0-0.bpo.1-686-pae > Architecture=x86 > Distribution=debian 8.2 > Desktop=MATE > Theme=Gtk > Language=es_VE.UTF-8 > Memory=1688M > > [Libraries] > Cairo=libcairo.so.2.11400.0 > Curl=libcurl.so.4.3.0 > DBus=libdbus-1.so.3.8.13 > GStreamer=libgstreamer-0.10.so.0.30.0 > GStreamer=libgstreamer-1.0.so.0.404.0 > GTK+2=libgtk-x11-2.0.so.0.2400.25 > GTK+3=libgtk-3.so.0.1400.5 > OpenGL=libGL.so.1.2.0 > Poppler=libpoppler.so.46.0.0 > QT4=libQtCore.so.4.8.6 > SDL=libSDL-1.2.so.0.11.4 > > [Environment] > DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-U8DbCgTacQ,guid=29801e1e7e816be3b9ee8baa567184bd > DESKTOP_SESSION=mate > DISPLAY=:0.0 > GB_GUI=gb.qt4 > GDMSESSION=mate > GDM_LANG=es_VE.utf8 > GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/gambas3.desktop > GIO_LAUNCHED_DESKTOP_FILE_PID=2850 > GPG_AGENT_INFO=/run/user/1001/keyring/gpg:0:1 > HOME= > LANG=es_VE.UTF-8 > LANGUAGE=es_VE:es > LOGNAME= > MATE_DESKTOP_SESSION_ID=this-is-deprecated > PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games > PWD= > SESSION_MANAGER=local/:@/tmp/.ICE-unix/1098,unix/:/tmp/.ICE-unix/1098 > SHELL=/bin/bash > SSH_AGENT_PID=1121 > SSH_AUTH_SOCK=/run/user/1001/keyring/ssh > TZ=:/etc/localtime > USER= > XAUTHORITY=/.Xauthority > XDG_CURRENT_DESKTOP=MATE > XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/ > XDG_RUNTIME_DIR=/run/user/1001 > XDG_SEAT=seat0 > XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 > XDG_SESSION_ID=4 > XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0 > XDG_VTNR=7 -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!
All, I might be utterly wrong, but since Linux normally uses UTF-8, any high-bit-set char may be interpreted as one of the "multibyte char" flags. If isprint() takes this into account, then it's dead right that char by itself is not printable! Hope that helps and makes sense... On 2015-12-29 11:53, Ru Vuott wrote: > Tchao Fabien, > Ru .. Characters > to 127 are printable... > uhmmm... excuse me, but I do not understand. > If I test the "printability" :-) of "characters > to 127" by using C > "isprint()" function (that checks whether the passed character is printable), > I obtain only zero results. > Where: "isprint()" function returns a non-zero value (true) if character is > printable, else zero (false) if character is NOT printable. > > * > #include > int main() { > int i, c; > for (i=128; i <= 255; ++i) { > c = isprint(i); > printf("%d %d\n", i, c); > } >return (0); > } > * > So, it seems resulting that "characters > to 127" are NOT printable > characters. > Ciao -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Video question
On 2016-02-10 08:37, richard terry wrote: > On 10/02/16 22:24, Benoît Minisini wrote: >> Le 10/02/2016 12:22, richard terry a écrit : >>> On 10/02/16 21:48, Benoît Minisini wrote: gb.media can do that. >>> MediaView1.URL = Media.URL("https://www.youtube.com/watch?v=h-cUFt2t0IY";) >>> >>> Hi Benoit, >>> This doesn't work ?am I missing something? >>> What I wanted to do was to stream an i-p camera from my front office to >>> my room with a little media control in the corner of a window. >>> thanks >>> richard >> Are you kidding? 'https://www.youtube.com/watch?v=h-cUFt2t0IY' is >> "youtube", the website. Not the url of a streamed video! > Benoit you should know by now I nothing of these things. So are you > saying that if you point the control to a i-p camera if will work?. And > also, how come it doesn't play a URL of a video? Just remember I'm > ignorant of all things like this. Not trying to be stupid. > richard Richard, Most IP cameras come with a program to watch them. This is usually Windows. You can also use a browser, like Firefox, and the camera's URL will ask you for your credentials (user/pass). All this you know. Android apps -for example- ask you for the make/model of the cam, its URL and credentials to connect and stream the video. The point here is that you should check the URL of the page with the streaming video, after you connected successfully. For example, I do have a cam. I can use *http://x/index.html* to authenticate and connect. That's the cam main page, allows me to select use IE/FFox/Chrome, etc. Once I select Firefox, I get to see the cam video at *http://x/monitor2.html*. But even that is a page with some decoration and the video in the middle. I then right-click the streaming video itself and select '*Copy Image Location*'. This gives me the URL to access the video itself. In my particular cam's case (credentials changed, of course), it is *http://x/videostream.cgi?user=myuser&pwd=mypass*. Your cam's URL may (WILL!) change if it is a different make/model, but the steps are the same: 1- Authenticate and connect with browser and navigate to the video. 2- From the video, if possible, get the stream's URL via right-click/Copy Image Location in the browser. Beware that most (chinese) IP-cams will send your credentials in plain text in the URL, as shown in my case above. It can also happen that the cam does not send user/pass in the URL because it uses browser cookies. In such cases, you may need to prepend it to the URL in this form: *http://myuser:mypass@x/videostream.cgi *but, as you can see it also is sent in clear text. I'd recommend using a view-only user/pass combination. Disclaimer: I got this but did not test that it works with Gambas. It does work with several Android phones and browsers, though. Regards, zxMarce. -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Copy data like Ctrl-C
On 2016-03-09 12:42, Rolf-Werner Eilert wrote: > When I want to copy data for copy-and-paste like with Ctrl-C, how could > I do it directly from code (via press of a button) instead of offering a > text area for the mouse? > > In our database, sometimes I need a student's address in Writer or > another program. It would be nice to have a button to copy the relevant > fields automagically to be used in Writer by Ctrl-V. > > I haven't found any information about this because I don't know where to > look for. > > Thanks for your insight! > > Rolf For that you should use the Clipboard object: Clipboard.Clear Clipboard.Copy(txtData.Text) You can also .Paste() from the clipboard. -- Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Lenght of a string
José, A side note, no need also to use a FOR-NEXT to fill X spaces. You can do it in a single step: 'for i = 1 to (115 - len(name)) ' name = name & Space$(1) 'next name = String.Left$(name & Space$(115), 115) If you need the spaces at the left (for example to right-align numbers), you do the opposite: numberString = String.Right$(Space$(places) & Str$(number), places) 'The number will be right-aligned to "places" spaces and returned in numberString. As Oliver pointed, you should use the UTF-8 versions of the calls; otherwise you will have less than the expected characters in the resulting string. Regards, zxMarce. On 2016-04-06 11:00, Oliver Etchebarne Bejarano wrote: > You are writing utf-8 characteres, so the 'é' and the 'ô' are two bytes > long ("José Antônio" is 12 chars but 14 bytes long). > > I think you should either remove the tildes, or use UTF-8 string > functions (like String.len() instead of len()) for the calculations, and > then change the encoding to something like latin-1. And hope that your > system can understand the new encoding well... > > > El 06/04/16 a las 07:48, José Monteiro escribió: >> len("José Antônio") = 14 >> I need to fill a text file and upload it to a system in order to make an >> invoice. >> The field "name" must have lenght = 115. If shorter than that you must >> complement it with spaces. >> So: >> >> for i = 1 to (115 - len(name)) >> name = name & Space$(1) >> next >> >> The result is --> "José Antônio" + 101 spaces >> >> But, in the text file, "José Antônio" + 101 spaces is considered as having >> lenght = 113, not 115. >> The text file, then, is rejected by the system, because the following fields >> are not being correctly interpreted. >> Any sugestions? >> Thanks in advance >> >> >> >> -- >> View this message in context: >> http://gambas.8142.n7.nabble.com/Lenght-of-a-string-tp55855.html >> Sent from the gambas-user mailing list archive at Nabble.com. >> >> -- >> ___ >> Gambas-user mailing list >> Gambas-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port issues and events.
Alexie, Not really. This is my first attempt at a binary-exchange over serial in Gambas. Can't also find out the old G3 examples that might have existed about this and my web searches were unsuccessful. So, if you could point me to some example code to read a Byte[], I'll be grateful. My attempts to read to a Byte[] failed with SEGFAULT, or errors with no text. On the other hand, I just realized -again, happened to me in the past and I forgot it did- that the list does not send text inside RAW tags... The code can be seen only on Nabble's site, so I'm reinserting it here. Please excuse my notation; I know it's not Gambas standard. It's what I used for eons on QB45, VB3, VB4, VB5 VB6 and even .Net for my day to day work; (really) old habits die hard. Declarations: Private Const TEST_TX As String = "ø1" '0x02-0xF8-0x31-0x03 - Nabble's RAW TEXT tags removed some data from the string Private Const TEST_RX As String = "" '0x02-0x15-0x03 - Nabble's RAW TEXT tags removed some data from the string Private m_tty As SerialPort Private m_rxBuff As String = Null Instancing and setting the port up: 'Instance serial port and set properties m_tty = New SerialPort As "myTty" 'This should call myTty_Read() when there is data to read from the port, but it does not seem to trigger. Wonder why. m_tty.PortName = "/dev/" & m_port m_tty.Speed = m_speed Select Case m_parity Case "No/Space" m_tty.Parity = SerialPort.None Case "Even" m_tty.Parity = SerialPort.Even Case "Odd" m_tty.Parity = SerialPort.Odd End Select m_tty.DataBits = m_bits m_tty.StopBits = m_stop 'Encoder use hardware handshake (RTS/CTS) m_tty.FlowControl = SerialPort.Hardware 'Try opening the port m_tty.Open() m_tty.Blocking = False m_tty.DTR = True Then, I send TEST_TX and expect for either TEST_RX or a timeout: Public Function Test() As Boolean Dim tOut As Date = DateAdd(Now, gb.Second, 2) 'Reset RX Buffer, send test command and check for timeout/response m_tty.Drop 'Kill remaining send data m_tty.Begin() 'Start buffering Write #m_tty, TEST_TX 'Add to send buffer m_rxBuff = Null 'Kill RX buffer m_tty.Send()'Send buffer While (Now < tOut) And (m_rxBuff <> TEST_RX) Sleep 0.1 'This IF below should not be needed, but myTty_Read() never fires otherwise! If m_tty.InputBufferSize > 0 Then myTty_Read() Endif Wend Finally Return (m_rxBuff = TEST_RX) Catch Message.Error("Error '" & Error.Text & "' occurred in " & Error.Where) End Finally, this next is the problem code. It does not fire as expected when data arrives, and when I call it by hand in the IF above, if I try to READ #m_tty As String it chops off the leading 0x02 byte, and I could not figure out how to READ #m_tty As Byte[] or As Object (I get a null error; nothing on the message.error text, and no OK button on it either): Public Sub myTty_Read() Dim dLen As Integer = m_tty.InputBufferSize Dim sgmnt As Byte[] 'String = Null 'This here is my desperate attempt to read As String or As Object... 'Data should be available in the serial port buffer 'sgmnt = Read #m_tty As String 'm_rxBuff &= sgmnt sgmnt = Read #m_tty As Object m_rxBuff &= sgmnt.ToString Debug "Rx: (" & CStr(dLen) & ") " & sgmnt Catch 'This is triggered when reading As Object or As Byte[]. But the text is NULL and has no OK button! Message.Error("Error '" & Error.Text & "' occurred in " & Error.Where) End A breakpoint in the "sgmnt = Read #m_tty As ..." line show that the value of "dLen" is three, which is OK. But when I try to READ As String, the leading 0x02 is missing from the string, leaving only 0x15-0x03 (quick tooltip shows the string to be "\x15\x03"). When this is later compared to TEST_RX in Test(), the comparison obviously fails. TIA, zxMarce. -- Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port issues and events.
Fernando, I know what you mean. In my case I just wanted to show in the examples which bytes come and go through the port. I do know 0x02 (&H2 for Gambas) is a single byte with value 2. I'm not transmitting "0-x-0-2" over the wire as 4 bytes, I'm just transmitting a string whose first character has ASCII value 0x02. I have also been coding for years (started with QB45 in the nineties, and before that with ZX-81 and ZXSpectrum in BASIC and even Assembler). I have coded several countries' Fiscal Printer interfaces for my company (all of them RS232C). But all this I did on Mr Gates' in-operating systems and IDEs. I do not know, though, the basics of RS232 I/O on Gambas3, methinks: I do not know -for example- what is wrong in my code that makes serial xxx_READ events not trigger. I also do not know how to write/read proper binary-as-string (or even bynary-as-byte[]) to/from RS232. My particular issue with the program: When the .InputBufferSize is not zero, it shows 3, which is correct (I'm expecting three bytes or chars, with values 0x02-0x15-0x03). Immediately afterwards, when I READ these bytes into a string (the only working thing so far), the first byte (0x02) is chopped off and the LEN of the resulting string is 2. I wonder: How come? There were three bytes in the buffer and I get a two byte string! I think Gambas is treating the 0x02 as a string-lenght indicator, and fills the string with the rest of the buffer, therefore fetching 2 characters (this seems backed because the string gets the 0x15 and 0x03 bytes as its contents). But I need all three bytes. My not-so-wild-guess (which agrees with your advise) is that I must use Byte[] and not String to read these blocks. Problem is twofold: 1- (BAD) Cannot get the _READ event to trigger 2- (WORSE) Cannot figure out how to make Gambas return a Byte[] with the buffer contents. Any pointers or working examples in those directions WILL help. Hope I explained myself better now. Regards, zxMarce. On 2016-06-30 11:34, nand...@nothingsimple.com wrote: > I've done extensive work with the serial port for a dozen years > with 100% success 24 hour operation. > > Sometimes people get mixed up with "0x02" thinking it's binary. > That is 4 characters ascii. > I prefer to use chr(2) to create a 1 length string binary 2. > If you're going to use byte[] array > then byte[0] = 2 is the equivalent. > Using escape (like HTML encoding) is the incorrect thinking > -Fernando > > -- > Open WebMail Project (http://openwebmail.org) > > > -- Original Message --- > From: ML > To: gambas-user@lists.sourceforge.net > Sent: Thu, 30 Jun 2016 10:51:41 -0300 > Subject: Re: [Gambas-user] Serial Port issues and events. > >> Alexie, >> >> Not really. This is my first attempt at a binary-exchange over serial in >> Gambas. Can't also find out the old G3 examples that might have existed >> about this and my web searches were unsuccessful. >> So, if you could point me to some example code to read a Byte[], I'll be >> grateful. My attempts to read to a Byte[] failed with SEGFAULT, or >> errors with no text. >> >> On the other hand, I just realized -again, happened to me in the past >> and I forgot it did- that the list does not send text inside RAW tags... >> The code can be seen only on Nabble's site, so I'm reinserting it here. >> Please excuse my notation; I know it's not Gambas standard. It's what I >> used for eons on QB45, VB3, VB4, VB5 VB6 and even .Net for my day to day >> work; (really) old habits die hard. >> >> Declarations: >> >> Private Const TEST_TX As String = "ø1" '0x02-0xF8-0x31-0x03 - >> Nabble's RAW TEXT tags removed some data from the string >> Private Const TEST_RX As String = "" '0x02-0x15-0x03 - Nabble's RAW >> TEXT tags removed some data from the string >> Private m_tty As SerialPort >> Private m_rxBuff As String = Null >> >> Instancing and setting the port up: >> >> 'Instance serial port and set properties >> m_tty = New SerialPort As "myTty" 'This should call myTty_Read() >> when there is data to read from the port, but it does not seem to >> trigger. Wonder why. >> m_tty.PortName = "/dev/" & m_port >> m_tty.Speed = m_speed >> Select Case m_parity >> Case "No/Space" >> m_tty.Parity = SerialPort.None >> Case "Even" >> m_tty.Parity = SerialPort.Even >> Case "Odd" >> m_tty.Parity = SerialPort.Odd >> End Select >> m_tty.DataBits = m_bits >> m_tty.StopBi
Re: [Gambas-user] Missing images on the Wiki
Jesus, Please note that, since Gambas 3.8.1, IIRC, gb.db.odbc was made to support the so-called "Connection Strings". I am responsible for this mess, and am still trying to enhance it. None of the following is in the docs yet, AFAIK. Instead of passing a Host named in the corresponding INI file, you may well pass a Connection String. The only real ODBC set-up (tested with unixODBC, not iODBC) left for the user or sysadmin is the Driver configuration. The huge advantage of using connection strings, in my humble opinion, is that in order to use a different database engine you do not have to change any code; just the string used to connect. And this string can be part of the program configuration. For example, assume unixODBC, and FreeTDS and MySQL drivers are installed, and you have this odbcinst.ini: [FreeTDS] Description = FreeTDS Driver v0.91 Driver64 = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so Setup64 = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so UsageCount = 1 DontDLCLose = 1 fileusage = 1 [MySQL] Description = MySQL 5.1 ODBC Driver Driver64 = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc5.so Setup64 = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so UsageCount = 1 DontDLCLose = 1 fileusage = 1 You could connect with any FreeTDS- or MySQL- supported servers. No need to edit other INI files. Gambas 3 example (note that I only set 2 properties of $conn): Public $conn As Connection Public Sub cmdConnect_Click() Inc Application.Busy Try $conn.Close 'In case the button is clicked again SetStatus("Connecting...") DB.Debug = chkDBDebug.Value $conn.Type = "odbc" $conn.Host = txtConnString.Text 'txtConnString is a textbox with a (possibly) user-defined conn string. $conn.Open SetStatus("Connected OK to database '" & $conn.Name & "'") Finally Dec Application.Busy Catch SetStatus("Error connecting: " & Error.Text & " at " & Error.Where) End An example Connection String for FreeTDS that works with the code above (placeholders in angle-brackets): Driver=FreeTDS;TDS_Version=7.2;Server=;Port=;UId=;Pwd=;Database= The Driver= keyword instructs unixODBC to use the FreeTDS section defined in odbcinst.ini. All other keywords are particular to -and dependant on- the driver selected. This has been tested to work with MSSQL 2005 and 2008 servers. One quirk it has that I still could not fix is to return the proper database name in .Name. Looks like my C is not up to that task yet. Regards, On 2016-07-19 11:00, Jesus Guardon wrote: > Hi, > Just FYI, in the ODBC page there are several broken links to images. > I've been testing other paths to the pics, but I don't know even if > they are still in the HD: > http://gambaswiki.org/wiki/doc/odbc > Any chance to get it fixed? > (Beware of cached content) > Thanks! > Jesús Guardon -- zxMarce. -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial I/O with byte data
Alex, Without knowing the protocol/device you're communicating with, I don't think anyone will be able to give substantial help. But, after years of interfacing very diverse hardware via RS-232 (fiscal printers, cash-hanlding hardware, GPS, you name it!), I can tell you that it's not always easy, and docs sometimes lack info or are plain wrong. Unfortunately the bulk of my experience with hardware is in VB6... Maybe you're looking at some kind of protocol wrapper bytes... Can't really say without the detail. On 15/05/17 08:52, alexchernoff wrote: > Thanks, it works (both with .tostring and reading one by one... > But I get values I don't know how to convert, e.g. where I expect a > decimal 83 or hex 53 I get byte value of 253 ... Or instead of Decimal > 15 I get 225 :( > cheers! -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] 16 bit value in hex with MSB and LSB?
Alex, What you're receiving is two characters with ASCII values 3A (":") and 98 (not printable, ASCII code over 7F). In any case, there's no need to convert anything to hex. If bytes come in LSB first, you can use the *Integer@* function along with the *StrPtr* (or similar, don't remember in Gambas) function and get your 16-bit value back directly. If they come MSB first and your system is LSB first, then you can swap them and apply byte maths: * Dim firstByte As Byte = Asc(Left(myString, 1)**)'This gets the &H3A ASCII value from character ":" in firstByte. ** Dim nextByte As Byte = Asc(Mid(myString, 2, 1)) **'This gets the &h98 ASCII value in nextByte.** ** Dim wordValue As Integer = firstByte * &H100 + nextByte 'This gets &H3A98 in wordValue* I guess some byte juggling can be performed by the underlying Stream object in the serial port (to accomodate "endianness"), but never used it, so I cannot tell. Hope that helps, zxMarce. *On 18/05/17 06:28, alexchernoff wrote:* > Good day all, > In a serial string I receive a 16 bit value split into MSB and LSB in > hex, for example 15000 (3A 98) is sent as 2 bytes containing decimal > values of 3A and 98. > To convert that to decimal, I have to convert each to hex strings, > join them, add &H to it and then convert "&H3A98" to decimal. > Maybe there is an easier way? > Thanks! -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] odbc dsn-less support or "connection strings" and documentation status?
Piccoro, Using ODBC via ConnectionString needs only the Connection.Type (so that gambas knows it should use the ODBC component) and Connection.Host (for the connection data) properties correctly set. The component will, first and foremost, scan the .Host property looking for semicolons (";"). If it finds at least one, it will assume the property holds a ConnStr. If there are no semicolons, it will connect as it always did, with a DSN. Otherwise, it will use the ConnStr in .Host to call ODBC's SQLDriverConnect() function. But when the component calls that ODBC function, no other (gambas) component properties are used, and thus are ignored. It is assumed that all necessary data to connect is present in the ConnStr. If the component fails to connect when other (gambas) component properties are set, it could be something I did no foresee. Please elaborate and I'll try to see if I can fix it. zxMarce On 23/05/17 14:01, PICCORO McKAY Lenz wrote: > well in my svn version of 3.9 are working.. but i dont know if are available > in 3.9.0 officially > also noted that code must configure only host and type, if any other are > configured connection will fail > Lenz McKAY Gerardo (PICCORO) > http://qgqlochekone.blogspot.com > > 2017-05-23 12:55 GMT-04:00 PICCORO McKAY Lenz : >> the odbc gambas connection supports DSN-less mode? i mean, all the settings >> into the gambas code, no need of ini files i remenber that this are, since >> Gambas 3.8.1, IIRC, gb.db.odbc was made to support the so-called "Connection >> Strings". >> i can update the documentation but i wish to know if are available in gambas >> 3.9.0 at leas http://gambaswiki.org/wiki/doc/odbc for the missing image >> cache i can sustituye and upload newer or made a text only >> Lenz McKAY Gerardo (PICCORO) >> http://qgqlochekone.blogspot.com -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] odbc dsn-less support or "connection strings" and documentation status?
It should; as far as I know nobody sent any further patches to the ODBC component other than me... On 23/05/17 14:59, PICCORO McKAY Lenz wrote: > hi Ml/zxMarce this feature are available officially in the normal 3.9.X > release and up? i use the svn and i dont know if ! > > Lenz McKAY Gerardo (PICCORO) > http://qgqlochekone.blogspot.com > > 2017-05-23 13:56 GMT-04:00 ML : > >> Piccoro, >> >> Using ODBC via ConnectionString needs only the Connection.Type (so that >> gambas knows it should use the ODBC component) and Connection.Host (for >> the connection data) properties correctly set. >> >> The component will, first and foremost, scan the .Host property looking >> for semicolons (";"). If it finds at least one, it will assume the >> property holds a ConnStr. >> If there are no semicolons, it will connect as it always did, with a >> DSN. Otherwise, it will use the ConnStr in .Host to call ODBC's >> SQLDriverConnect() function. >> But when the component calls that ODBC function, no other (gambas) >> component properties are used, and thus are ignored. It is assumed that >> all necessary data to connect is present in the ConnStr. >> >> If the component fails to connect when other (gambas) component >> properties are set, it could be something I did no foresee. Please >> elaborate and I'll try to see if I can fix it. >> >> zxMarce >> >> On 23/05/17 14:01, PICCORO McKAY Lenz wrote: >>> well in my svn version of 3.9 are working.. but i dont know if are >> available in 3.9.0 officially >>> also noted that code must configure only host and type, if any other are >> configured connection will fail >>> Lenz McKAY Gerardo (PICCORO) >>> http://qgqlochekone.blogspot.com >>> >>> 2017-05-23 12:55 GMT-04:00 PICCORO McKAY Lenz : >>>> the odbc gambas connection supports DSN-less mode? i mean, all the >> settings into the gambas code, no need of ini files i remenber that this >> are, since Gambas 3.8.1, IIRC, gb.db.odbc was made to support the so-called >> "Connection Strings". >>>> i can update the documentation but i wish to know if are available in >> gambas 3.9.0 at leas http://gambaswiki.org/wiki/doc/odbc for the missing >> image cache i can sustituye and upload newer or made a text only >>>> Lenz McKAY Gerardo (PICCORO) >>>> http://qgqlochekone.blogspot.com >> >> >> >> -- >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> ___ >> Gambas-user mailing list >> Gambas-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-user >> > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Working with .so library
On 15/06/17 08:48, Admin wrote: > 15.06.2017 17:54, Admin пишет: >> 15.06.2017 16:19, Tobias Boege пишет: All your help was very important for me, I now have completed my cash register software to the point where it does everything my company needs. I must say Gambas is a great language, it's very easy to learn from scratch, I'm surprised how obvious everything is. But there is a lot of work for me left to do mostly in terms of managing wrong human actions. My software works good if the employee doesn't do any mistakes, but that's unrealistic, so there's a lot of things I want to control and check. And that's where I'm stuck. This library (which still calls itself a driver) theoretically is able to return a lot of values that I need, but I can't understand basic rules of how do we take output from a C-lib in Gambas. From http://gambaswiki.org/wiki/howto/extern I understood that I need to locate a space in memory and pass a pointer to a library so that it can write data into that place in ram, which I would then read and set free. So I have to declare a pointer, then Alloc(8) it, then pass it to my library and then read from it like it is a stream. Does this principle still work in current version of Gambas? >>> If you do Alloc(8), then you get 8 bytes of memory. You most likely >>> *don't* >>> want to read that like a stream, but use Integer@() or similar >>> functions. What I don't understand is how I construct the code in my particular case. To make an interface to the library I declare external pointer like this: Extern CreateFptrInterface(ver As Integer) As Pointer Then I declare some pointers that I'll use with help of the interface I created: Extern put_DeviceEnable(p as Pointer, mode as Integer) Extern GetStatus(p as Pointer, StatRequest as String) Then I declare the pointer which will be that interface: Public kkmDrv as Pointer So then in sub I can do kkmDrv = CreateFptrInterface(12) ' this establishes the interface put_DeviceEnabled(kkmDrv, 1) ' this transfers the comand to the library through the interface. And it works great. But then If I want to get some data from the library, as I understand, I have to declare another pointer, allocate ram for it and pass my request. I don't understand how should I pass that pointer to GetStatus() while also passing my interface pointer to it, let alone reading data back. Totally confused. >>> This entirely depends on how the C functions in your library are >>> declared. >>> I don't know about your specific library but commonly the occurence >>> of an >>> error is indicated by an integer return code, e.g. this might be the >>> signature of one of the functions in your library: >>>int myfunction(void *interface, int argument) >>> If the documentation says that the return value (int) of this function >>> indicates an error, then you just need to get that return value back >>> into >>> your Gambas program, which you accomplish by declaring the function in >>> Gambas as >>>Extern myfunction(interface As Pointer, argument As Integer) As >>> Integer >>> (notice the trailing "As Integer"). Then you can use "myfunction" in >>> your >>> Gambas code like any other function and get and interpret its return >>> value. >>> So, if this convention for error reporting is used, it is much >>> simpler to >>> get information about errors, without using Alloc() and co. Your >>> library >>> may use a different convention which actually involves pointers, but >>> I wouldn't know. >>> Regards, >>> Tobi >>> >> I should've said it in the beginning. Ofcourse any function returns >> integer value of 0 as success or -1 as error, but that only indicates >> that function was successfully executed or not. So GetStatus() will >> always return 0 because it shurely ran, nothing can go wrong here. >> But that's not the result I want. GetStatus() actually gives back a >> string with the status I asked for. Not that I fully understand how >> it does that. I already gave links to the libfptr.so library itself >> (http://allunix.ru/back/atol.tar.gz) and it's header files >> (http://allunix.ru/back/atol-header.tar.gz) so that it's clearer, >> what I'm talking about, unfortunately I am absolute zero in C to >> figure things out myself. >> For example I can see that to get serial number of the device driven >> by that library i can use a function described like this: >> get_SerialNumber(void *ptr, wchar_t *bfr, int bfrSize); >> As far as I can tell what it does is it gets data needed and puts it >> into some buffer. The result of executing this function through >> put_SerialNumber(kkmDrv) will always be returned to me as 0. >> So to see what's in that buffer, I have to then invoke >> GetS
Re: [Gambas-user] sqlite gambas table info?
On 16/06/17 14:48, PICCORO McKAY Lenz wrote: > its there some code to get BEFORE send the query the fields of the table? > > i mean, in the following code example i already know the column name, but i > need firts detect column name to send amount of filters > > sCriteria *=* "id = &1"iParameter *=* *1012*$hConn*.*Begin' Same as > "SELECT * FROM tblDEFAULT WHERE id = 1012"hResult *=* > $hConn*.*Edit*(*"tblDEFAULT"*,* sCriteria*,* iParameter*)* > > > in this case, the column "id" was previously knowed! but in my case i need > to detect all the column names firts before send the filters/parameters > criteria > > please any help? > > Lenz McKAY Gerardo (PICCORO) > http://qgqlochekone.blogspot.com Piccoro, Does this help? Dim fld as Field For Each fld In Result.Fields ... do whatever with field names Next zxMarce -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] I need a hint on how to deleted duplicate items in a array
On 30/06/17 08:20, Fernando Cabral wrote: > 2017-06-30 7:44 GMT-03:00 Fabien Bodard : >> The best way is the nando one ... at least for gambas. >> As you have not to matter about what is the index value or the order, >> the walk ahead option is the better. >> Then Fernando ... for big, big things... I think you need to use a DB. >> Or a native language maybe a sqlite memory structure can be good. > Fabien, since this is a one-time only thing, I don't think I'd be > better off witha database. > Basically, I read a text file an then break it down into words, > sentences and paragraphs. > Next I count the items in each array (words, sentences paragraphs). > Array.count works wonderfully. > After that, have to eliminate the duplicate words (Array.words). But > in doing it, al also have to count how many times each word appeared. > Finally I sort the Array.Sentences and the Array.Paragraphs by size > (string.len()). The Array.WOrds are sorted by count + lenght. This is > all woring good. > So, my quest is for the fastest way do eliminate the words duplicates > while I count them. > For the time being, here is a working solution based on system' s sort > | uniq: > Here is one of the versions I have been using: > Exec ["/usr/bin/uniq", "Unsorted.txt", "Sorted.srt2"] Wait > Exec ["/usr/bin/uniq", "-ci", "SortedWords.srt2", SortedWords.srt3"] Wait > Exec ["/usr/bin/sort", "-bnr", SortedWords.srt3] To UniqWords > WordArray = split (UniqWords, "\n") > So, I end up with the result I want. It's effective. Now, it would be > more elegant If I could do the same with Gambas. Of course, the > sorting would be easy with the builting WordArray.sort (). > But how about te '"/usr/bin/uniq", "-ci" ...' part? > Regards > - fernando Not tried, but for the duplicate count, what about iterating the word array copying each word to a keyed collection? For any new given word, the value (item) added would be 1 (integer), and the key would be UCase(word$). If an error happens, the handler would just Inc the keyed Item value. So (please note my syntax may be slightly off, especially in If Error): Public Function CountWordsInArray(sortedWordArray As String[]) As Collection Dim wordCount As New Collection Dim currentWord As String = Null For Each currentWord In sortedWordArray Try wordCount.Add(1, UCase$(currentWord)) If Error Then Inc wordCount(UCase$(currentWord)) Error.Clear 'Is this needed, or even correct? End If Next Return (wordCollection) End The returned collection should be sorted if the array was, and for each item you will have a numeric count as the item and the word as the key. Hope it helps, zxMarce. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] who to detect if are running inside IDE
On 03/07/17 14:23, PICCORO McKAY Lenz wrote: > a piece of code to who to detect if are running inside IDE? any ideas how > to? > > Lenz McKAY Gerardo (PICCORO) > http://qgqlochekone.blogspot.com In the old days of VB6 I tried to print the result of 1/0 to the DEBUG pane. Since output to the debug pane is ignored in VB6 compiled, there would be no error in the final compiled app. I don't know if Gambas does the same, but try this: Function InIDE() As Boolean Dim retVal As Boolean = False Try Debug (1/0) retVal = (Error.Code <> 0) Error.Clear Return retVal End Hope it helps, zxMarce -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Switching to GitLab
Piccoro, Please don't take it personal. I tried to read that same wiki page, and I had the same issues as Christof; could not make heads nor tails of it. You know your english lacks sometimes, and have been told so a couple of times now. To make things worse, it looks -to me at least- that you assume your audience to be as vastly experienced in Git as you are. As an example, I forked the official repo for ODBC-tweaking only after I saw two or three other sites and read over one hour from other Git sites, and bits from the mails and the wiki. And even so, I'm not sure I understood half of it! I can translate technical SPA to ENG if I'm given an equally coherent spanish text. If you care to write it, I can translate it for you so you reupload it. Also, as I said, it looks like you use Git for very long and know how it works pretty well. Please try to write the guide in a way that's more newbie-friendly and Gambas-repo-policies oriented (I mean, using the proper "workflow"), so people like me that NEVER used Git are not scared to type something and blow Benoît's hard work sky-high! Regards, On 23/08/17 14:39, PICCORO McKAY Lenz wrote: > well cristhof, you could improve it! please go on! of course all the > wiki pages are a couple of many modifications over the time, until got > pretty well done! > sorry for my bad english.. do you write at the gambas wiki? you can > improve it.. > Lenz McKAY Gerardo (PICCORO) > http://qgqlochekone.blogspot.com > > 2017-08-23 13:27 GMT-04:00 Christof Thalhofer : >> Am 23.08.2017 um 19:04 schrieb PICCORO McKAY Lenz: >>> Jussi, that commands are good.. that's the difference: >>> git checkout onlyif you trash changes by files (one file or only >>> some files) >>> git reset for a entire branch (all the files that changes) >> Sorry, but what you write is not understandable. And this: >> http://gambaswiki.org/wiki/howto/git >> should first be translated to English before recommending it to >> newcomers in Git! I am not able to tell, whether it's content is >> right, as I hardly understand it. >> >> Sentences like >> >> "In Gambas git repository the work are in the branch, master are >> the principal and the develop working, there's a stable branch and >> some other of not yet working and in develop work like the cmake >> future feature." >> >> are pure nonsense. >> And this piece is full of such sentences! >> Alles Gute >> Christof Thalhofer >> -- >> Dies ist keine Signatur -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] "Long" click
My guess is that you want a new form to appear after the button is raised, but having been pressed more than X seconds. To this end, I'd add a timer with the desired "long-click lenght" to the main form (the one that "receives the long-click"). Maybe also the form and all its controls should have an observer and apply the timer to the observer, if more than one control may receive the "long click". So it would be MouseDown->Enable timer->MouseUp->Disable Timer. If the timer triggered, the form should be shown: Public Sub Form1_MouseDown() 'Start timing clicks tmrLongClickEnabled = True End Public Sub Form1_MouseUp() 'Stop timing clicks tmrLongClick.Enabled = False End Public Sub tmrLongClick_Timer() 'If the timer triggered before being disabled, it was a "long-click", so we show the "other" form Form2.Show() 'We also disable the timer so no more than ONE form is shown per "long-click". tmrLongClick.Enabled = False End Disclaimer: It looks good on paper, but did not actually try it. HTH, zxMarce On 21/09/17 06:28, Gianluigi wrote: > I'm not sure I understand, but that's not enough? > > Public Sub Button1_MouseDown() > > Form1.Show() > > End > > Public Sub Button1_MouseUp() > > Form1.Hide() > > End > > Regards > Gianluigi > > 2017-09-21 8:19 GMT+02:00 Miguel Manso : >> Hi All, >> I'm using gambas3 for some time now and I'd like to know your opinion >> about the best way to implement a "long" click. >> The idea is to leave a button presses for a certain amount of seconds >> and without releasing it, a new form will open. >> We did this using a timer but I'd like to know if there's any >> "recommended" way of doing it. >> Thanks. >> -- >> Miguel Manso -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Apps
*On 13/07/18 12:28, John Rose wrote:* > I used to put my Gambas developed apps on a particular website. > However, I've now lost its URL. Does anyone know the URL of such a site? > I have a number of Gambas apps. I've just changed my iRecorder app > (which uses the get_iplayer command line program) to operate better. > This app is a GUI to record BBC TV & radio programmes. At the moment I > just create a .deb as I use Ubuntu mainly. > I have a number of other Gambas apps e.g. Enigma cyphering, Bombe > simulation, Lorenz cyphering, Colossus simulation, Stream Recording. > All my apps are free of charge. If anyone's interested, post to the > user list: though I only look at the daily digest. John, I'd be delighted to see your WWII cypher work, especially the Lorenz. Are you sharing the sources or the binaries? Also, on cypher machines: Anything about the Russian FIALKA ("violet")? I think its codename was M-125 (http://www.cryptomuseum.com/crypto/fialka/). Thanks! zxMarce. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user