Re: [Gambas-user] Time, date & Settings

2017-03-27 Thread Benoît Minisini
Le 27/03/2017 à 07:27, PICCORO McKAY Lenz a écrit :
> similar behavior occurs me when i swicht languajes and manipulates amounts
> in my POS system, in english vs spanish decimals alternate with "," and "."
> and theres no way to use an universa only form..
>
> u must stored separated..
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-03-26 20:11 GMT-04:00 Jussi Lahtinen :
>
>> Hi!
>> I'm trying to figure way to handle time & date correctly, ignoring timezone
>> and "daylight saving" adjustments. I can't get things work nicely with
>> settings component as it does not save&load the value in universal format.
>> Example if you write settings in English and open them in Finnish, you will
>> get silent error:
>>
>> Print Settings[sPath &/ "Date&Time", Null]
>> 03/27/2017 12:00:00  <--- this is correct time
>>
>> Print Val(Settings[sPath &/ "Date&Time", Null])
>> This returns nothing, not even error.
>>
>> Print CDate(Settings[sPath &/ "Date&Time", Null])
>> 27.03.2017 09.00.00  <--- this is incorrect time
>>
>> This is from the GAlarm project and I want to ignore timezones etc, because
>> I want the alarms go off accordingly to the computer clock. IE alarm set to
>> go off at 12:00 should go off, if computer clock shows 12:00. Not at 09:00,
>> because I cannot know what timezone the user meant, so I always assume
>> local.
>>
>>
>> Do I have to write seconds, minutes, hours, etc separately in the settings
>> or could this be fixed somehow..?
>>
>>
>>
>> Jussi

Using the development version, you have to store your date in the 
settings file using CStr(), and read it using CDate().

Regards,

-- 
Benoît Minisini

--
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] Time, date & Settings

2017-03-27 Thread Jussi Lahtinen
> Using the development version, you have to store your date in the
> settings file using CStr(), and read it using CDate().
>

That does not work if the settings file is written in English and opened in
Finnish. CDate() just fails silently (returns null).


Jussi
--
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] Time, date & Settings

2017-03-27 Thread Benoît Minisini
Le 27/03/2017 à 17:02, Jussi Lahtinen a écrit :
>> Using the development version, you have to store your date in the
>> settings file using CStr(), and read it using CDate().
>>
>
> That does not work if the settings file is written in English and opened in
> Finnish. CDate() just fails silently (returns null).
>
>
> Jussi

It should not with the development version, as CDate() and CStr() only 
use the american format.

-- 
Benoît Minisini

--
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] collection of collection problem

2017-03-27 Thread Fabien Bodard
Hi Lenz,

GambasForge was not an Community project but my own project at first.
That's why it is not conventionnal.

The goal was just to give a place for french people to share gambas
programs and code piece. This was also for me my first try on gambas
cgi.


Why hidding urls ? well in fact it's not really hidding it's making it
more human readable. In fact in a rewritted url you have all the
needed stuff to generate the true url.

http://gambasforge.org?section=forge&action=code&id=2


Main Sub Main()

Call the dispacher thatcall the Function CCode.VoirCode

'It's ShowCode for english speakers
Public Sub VoirCode()

  Dim tCode As Code
  Dim id As Integer

  'check the id value integrity
  If IsInteger(Request.Get!id) Then id = Request.Get!id
  If id < 1 Then Error.Raise("Invalid id.")

  'Getting the code datas in a specialzed structure
  tCode = MCode.VoirCode(Id)

  If Not tCode Then
Main.Erreur("Ce code n'existe pas.")
Main.RedirectPage("forge.html")
Return
  Endif

'  Get the code commentary if any
  tCode.Commentaires = MCode.VoirCommentaires(tCode.Id)

  'Drawing the page
'  Call the common header
  CMain.Top()
'Add some scripts
  ThisPage.Scripts.Add("js/forge.js")
  ThisPage.StyleSheets.Add("css/code.css")
'  Adding the codepage
  VCode.VoirCode(tCode, MMain.MembreConnecte())

'add the bottom
 CMain.Bottom
'Render the full tree at once
  Main.Show

End


All the site is based on a virtual html Dom Tree. That during this
period that i've begin my idea of Html tree. And then Adrien have re
writted all the stuff in C and generated the gb.xml.html component.

The advantage of the tree is I can modify my header or adding some
script from every where. So for example the VoirCode function can
display Messages in the standart header. Then with the time some part
become objects like HtmlRecaptcha there are all stored in FormElements
sub directory.



2017-03-27 6:01 GMT+02:00 PICCORO McKAY Lenz :
> in the more and more lack of documentation in spanish and differences
> respect others languajes (i'm not programer), triying to develop a web page
> in gabmas (to large scale) its dificult later to mantain..
>
> just taking a look to the gambas forge at the svn in sourceforge.. for
> people that "wants" to contribute its very tedious and in few days interes
> are loose quickly... that's my point in the ohter mail..
>
> i now get in understand that gambas force use many alias urls, and has 3
> kind of parameters
>
> once its for a main section, that determines the "kind" of software (main
> page, forums, wiki or forge)
>
> second its a section of that firts..
>
> the other i cannot understand still
>
> also, why hide the urls? and in the ide its hard to debug due the variable
> CGI_SCRIPT are not used in the IDE, due runs in embebed server, rather that
> the generated gforge.gambas.cgi program...
>
> or gambas its just for "great programers"?
>
> also there's so many hardcode typing urls
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-03-25 17:40 GMT-04:00 Jorge Carrión :
>
>> Fabian: +1  :)
>>
>> 2017-03-25 16:51 GMT+01:00 Fabien Bodard :
>>
>> > A long thought in bazaar...
>> >
>> >
>> > I think, the first job is to teach a new time to developpers how to
>> > develop. There is nothing great in the code i've sended, juste the
>> > evidence.
>> >
>> > I've start learnin coding in gwbasic and qbasic... well not the best
>> > to start. Now we have better languages like python, java, c# and
>> > i've the impression that taking one hour for making the lacking
>> > function,has become something insurmountable (in this case 10 minutes
>> > for me).
>> >
>> > In the past I had no choice, no internet, if I wanted something or if
>> > it did not exist, you had to buy it or create it (sometimes find it in
>> > a book). Honestly, today I have reproduced so much with Gambas that I
>> > think we can almost do everything. What is lacking in Gambas is
>> > documentation. Unfortunately, we do not have time to write it because
>> > we have grown up and have a lot of work now. All I can do is swing
>> > from time to time a spade on the mailing list to help the newcomers to
>> > understand the pattern of thought behind Gambas. Because I see that
>> > this is also the problem. Whether at the level of the language or at
>> > the level of the arrangement of forms, at the level of the event
>> > structure (gridview, drawingarea and many other widgets), the choices
>> > are quite innovative and destabilizing. Gambas is not there to replace
>> > or compete with other languages, it is as in kungfu there are several
>> > phylosophy and it is one among others.
>> > To summarize it is not the language in itself that must be understood,
>> > but the phylsophy of development. For the language, there is the wiki.
>> > For phylosophy ... we'll have to bend over.
>> >
>> > Benoit, had said that language was able to appreciate different types
>> > of procedural, object or event programming. But with time

[Gambas-user] Help with Observer 'Stop Event'

2017-03-27 Thread Riccardo
I have an observer on a ValueBox control to prevent it changing to zero and
to prevent it becoming larger than the value in a different ValueBox.

Public Sub valNumObserver_change()

  If valNum.value = 0 Then valNum.Value = 1
  If valNum.Value > valDen.Value Then Stop Event

End

With first case, where the zero value is changed to one, works. But the Stop
Event doesn't do what I expect (it does nothing actually) in the second
line...



--
View this message in context: 
http://gambas.8142.n7.nabble.com/Help-with-Observer-Stop-Event-tp58715.html
Sent from the gambas-user mailing list archive at Nabble.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] Help with Observer 'Stop Event'

2017-03-27 Thread Tobias Boege
On Mon, 27 Mar 2017, Riccardo wrote:
> I have an observer on a ValueBox control to prevent it changing to zero and
> to prevent it becoming larger than the value in a different ValueBox.
> 
> Public Sub valNumObserver_change()
> 
>   If valNum.value = 0 Then valNum.Value = 1
>   If valNum.Value > valDen.Value Then Stop Event
> 
> End
> 
> With first case, where the zero value is changed to one, works. But the Stop
> Event doesn't do what I expect (it does nothing actually) in the second
> line...
> 

The documentation about Stop Event [1] says:

  This statement must be used in an event handler. It tells the interpreter
  that the event that called the event handler must be cancelled.

This may have mislead you to overestimate what the interpreter does when
it encounters a Stop Event.

What roughly happens when an object raises an event, by using the Raise
keyword, is: (1) all "before" observers receive the event, then (2) the
default observer of the object receives the event, and lastly (3) all
"after" observers receive the event. For each observer, the corresponding
event handler is called and as soon as one of these event handlers use
Stop Event, this whole chain is aborted.

But that's about all the interpreter can do. It stops propagation of the
event to later observers. Imagine that your Observer object is one of
potentially many observers waiting in line to be notified of the ValueBox
Change event. By using Stop Event you tell the interpreter to skip those
observers behind you, which have not seen the event yet.

At that point, the program flow gets back to the ValueBox -- but the
important fact is, for the component programmer, the one who wrote the
ValueBox code, obeying Stop Event is completely voluntary. What he does
is out of the interpreter's reach.

The programmer can choose to get a notification of whether the event was
aborted by getting the return value of the Raise keyword:

  Dim bCancel As Boolean

  bCancel = Raise Change

This value tells him if someone called Stop Event or not. But he is free
to ignore that value, or to react to it however he wants. He may even abort
the event whenever you tell him not to.

Now look at the source code of ValueBox (comp/src/gb.form/.src/ValueBox.class):

--8<---[ $ grep -C 2 "Raise Change" ValueBox.class ]
  If $hTextBox.Text <> $sLastText Then
$sLastText = $hTextBox.Text
Raise Change
  Endif

  --
  Public Sub DateBox_Change()

Raise Change

  End
  --
  Public Sub CurrencyBox_Change()

Raise Change

  End
  --
  Public Sub IpAddressBox_Change()

Raise Change

  End
--8<

The programmer chose to ignore Stop Event for every instance of raising the
Change event [*]. I'm not sure if there is anything you can do about it,
apart from dirty hacks or writing your own ValueBox. Maybe you should just
try and ask Benoit to add support for Stop Event in the ValueBox.

Regards,
Tobi

[*] This is normal actually. You can grep through the source tree for
"= Raise" on the one hand and "^ *Raise" on the other. It gives me
a ratio of 28/865, so about 3% of Raise statements even consider the
possibility that the user Stop Event's them. This is only counting
non-native Gambas events, though.

[1] http://gambaswiki.org/wiki/lang/stopevent

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

--
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] collection of collection problem

2017-03-27 Thread PICCORO McKAY Lenz
2017-03-27 12:38 GMT-04:00 Fabien Bodard :

> Hi Lenz,
>
> GambasForge was not an Community project but my own project at first.
> That's why it is not conventionnal.
>
umm isuspect that but my hope was due the "framework" word as propaganda (i
dont remenber where i read.. well whatever)


http://gambasforge.org?section=forge&action=code&id=2
>
>
>   'check the id value integrity
>   If IsInteger(Request.Get!id) Then id = Request.Get!id
>   If id < 1 Then Error.Raise("Invalid id.")
>
> '  Get the code commentary if any
>   tCode.Commentaires = MCode.VoirCommentaires(tCode.Id)
>
these part its for comments.so.?


> All the site is based on a virtual html Dom Tree. That during this
> period that i've begin my idea of Html tree. And then Adrien have re
> writted all the stuff in C and generated the gb.xml.html component.
>
that's awesome.. the gb.xml module are so usefully for parsing some socket
messages and emulates and webservice.. my only problem its a lack of
authentication and session handler

now that's the reason of the tree parsing mode of the code.. thanks for
clarify...


> The advantage of the tree is I can modify my header or adding some
> script from every where. So for example the VoirCode function can
> display Messages in the standart header. Then with the time some part
> become objects like HtmlRecaptcha there are all stored in FormElements
> sub directory.
>
that part its quite complicated for me, but dont worry i'm studing right
now all the realted theme...


>
>
>
> 2017-03-27 6:01 GMT+02:00 PICCORO McKAY Lenz :
> > in the more and more lack of documentation in spanish and differences
> > respect others languajes (i'm not programer), triying to develop a web
> page
> > in gabmas (to large scale) its dificult later to mantain..
> >
> > just taking a look to the gambas forge at the svn in sourceforge.. for
> > people that "wants" to contribute its very tedious and in few days
> interes
> > are loose quickly... that's my point in the ohter mail..
> >
> > i now get in understand that gambas force use many alias urls, and has 3
> > kind of parameters
> >
> > once its for a main section, that determines the "kind" of software (main
> > page, forums, wiki or forge)
> >
> > second its a section of that firts..
> >
> > the other i cannot understand still
> >
> > also, why hide the urls? and in the ide its hard to debug due the
> variable
> > CGI_SCRIPT are not used in the IDE, due runs in embebed server, rather
> that
> > the generated gforge.gambas.cgi program...
> >
> > or gambas its just for "great programers"?
> >
> > also there's so many hardcode typing urls
> >
> > Lenz McKAY Gerardo (PICCORO)
> > http://qgqlochekone.blogspot.com
> >
> > 2017-03-25 17:40 GMT-04:00 Jorge Carrión :
> >
> >> Fabian: +1  :)
> >>
> >> 2017-03-25 16:51 GMT+01:00 Fabien Bodard :
> >>
> >> > A long thought in bazaar...
> >> >
> >> >
> >> > I think, the first job is to teach a new time to developpers how to
> >> > develop. There is nothing great in the code i've sended, juste the
> >> > evidence.
> >> >
> >> > I've start learnin coding in gwbasic and qbasic... well not the best
> >> > to start. Now we have better languages like python, java, c# and
> >> > i've the impression that taking one hour for making the lacking
> >> > function,has become something insurmountable (in this case 10 minutes
> >> > for me).
> >> >
> >> > In the past I had no choice, no internet, if I wanted something or if
> >> > it did not exist, you had to buy it or create it (sometimes find it in
> >> > a book). Honestly, today I have reproduced so much with Gambas that I
> >> > think we can almost do everything. What is lacking in Gambas is
> >> > documentation. Unfortunately, we do not have time to write it because
> >> > we have grown up and have a lot of work now. All I can do is swing
> >> > from time to time a spade on the mailing list to help the newcomers to
> >> > understand the pattern of thought behind Gambas. Because I see that
> >> > this is also the problem. Whether at the level of the language or at
> >> > the level of the arrangement of forms, at the level of the event
> >> > structure (gridview, drawingarea and many other widgets), the choices
> >> > are quite innovative and destabilizing. Gambas is not there to replace
> >> > or compete with other languages, it is as in kungfu there are several
> >> > phylosophy and it is one among others.
> >> > To summarize it is not the language in itself that must be understood,
> >> > but the phylsophy of development. For the language, there is the wiki.
> >> > For phylosophy ... we'll have to bend over.
> >> >
> >> > Benoit, had said that language was able to appreciate different types
> >> > of procedural, object or event programming. But with time I realize
> >> > that the object / event couple is dominant and that this is our
> >> > signature somehow.
> >> >
> >> > Today it is a coherent mature language (despite the bugs), with
> >> > coherent libraries.
> >> >
> >> > By experience, i

Re: [Gambas-user] Help with Observer 'Stop Event'

2017-03-27 Thread Benoît Minisini
Le 27/03/2017 à 22:18, Tobias Boege a écrit :
> On Mon, 27 Mar 2017, Riccardo wrote:
>> I have an observer on a ValueBox control to prevent it changing to zero and
>> to prevent it becoming larger than the value in a different ValueBox.
>>
>> Public Sub valNumObserver_change()
>>
>>   If valNum.value = 0 Then valNum.Value = 1
>>   If valNum.Value > valDen.Value Then Stop Event
>>
>> End
>>
>> With first case, where the zero value is changed to one, works. But the Stop
>> Event doesn't do what I expect (it does nothing actually) in the second
>> line...
>>
>
> The documentation about Stop Event [1] says:
>
>   This statement must be used in an event handler. It tells the interpreter
>   that the event that called the event handler must be cancelled.
>
> This may have mislead you to overestimate what the interpreter does when
> it encounters a Stop Event.
>
> What roughly happens when an object raises an event, by using the Raise
> keyword, is: (1) all "before" observers receive the event, then (2) the
> default observer of the object receives the event, and lastly (3) all
> "after" observers receive the event. For each observer, the corresponding
> event handler is called and as soon as one of these event handlers use
> Stop Event, this whole chain is aborted.
>
> But that's about all the interpreter can do. It stops propagation of the
> event to later observers. Imagine that your Observer object is one of
> potentially many observers waiting in line to be notified of the ValueBox
> Change event. By using Stop Event you tell the interpreter to skip those
> observers behind you, which have not seen the event yet.
>
> At that point, the program flow gets back to the ValueBox -- but the
> important fact is, for the component programmer, the one who wrote the
> ValueBox code, obeying Stop Event is completely voluntary. What he does
> is out of the interpreter's reach.
>
> The programmer can choose to get a notification of whether the event was
> aborted by getting the return value of the Raise keyword:
>
>   Dim bCancel As Boolean
>
>   bCancel = Raise Change
>
> This value tells him if someone called Stop Event or not. But he is free
> to ignore that value, or to react to it however he wants. He may even abort
> the event whenever you tell him not to.
>
> Now look at the source code of ValueBox 
> (comp/src/gb.form/.src/ValueBox.class):
>
> --8<---[ $ grep -C 2 "Raise Change" ValueBox.class ]
>   If $hTextBox.Text <> $sLastText Then
> $sLastText = $hTextBox.Text
> Raise Change
>   Endif
>
>   --
>   Public Sub DateBox_Change()
>
> Raise Change
>
>   End
>   --
>   Public Sub CurrencyBox_Change()
>
> Raise Change
>
>   End
>   --
>   Public Sub IpAddressBox_Change()
>
> Raise Change
>
>   End
> --8<
>
> The programmer chose to ignore Stop Event for every instance of raising the
> Change event [*]. I'm not sure if there is anything you can do about it,
> apart from dirty hacks or writing your own ValueBox. Maybe you should just
> try and ask Benoit to add support for Stop Event in the ValueBox.
>
> Regards,
> Tobi
>
> [*] This is normal actually. You can grep through the source tree for
> "= Raise" on the one hand and "^ *Raise" on the other. It gives me
> a ratio of 28/865, so about 3% of Raise statements even consider the
> possibility that the user Stop Event's them. This is only counting
> non-native Gambas events, though.
>
> [1] http://gambaswiki.org/wiki/lang/stopevent
>

The "Change" event means that something has changed. So there is no 
point in cancelling it, you cannot change the past.

-- 
Benoît Minisini

--
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] Time, date & Settings

2017-03-27 Thread Jussi Lahtinen
OK, forgot to update Gambas on my virtual machine...

But now there is another problem. I'm in UTC+3, and when I write the time
(example 12:00) with CStr(), it will be 15:00 in the settings file. Now if
I go to UTC-0, I will get the alarm when my computer clock shows 15:00. I
want it always assume local time.

Example if I have meeting in UK at 31.3.2017 12:00, I want simply set the
alarm for 31.3.2017 12:00, independently of where I'm now. The device I'm
using should worry about timezones not me.


Jussi

On Mon, Mar 27, 2017 at 6:15 PM, Benoît Minisini <
gam...@users.sourceforge.net> wrote:

> Le 27/03/2017 à 17:02, Jussi Lahtinen a écrit :
> >> Using the development version, you have to store your date in the
> >> settings file using CStr(), and read it using CDate().
> >>
> >
> > That does not work if the settings file is written in English and opened
> in
> > Finnish. CDate() just fails silently (returns null).
> >
> >
> > Jussi
>
> It should not with the development version, as CDate() and CStr() only
> use the american format.
>
> --
> Benoît Minisini
>
> 
> --
> 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