Re: [Gambas-user] variable in WebForm not remember

2017-01-23 Thread Rolf-Werner Eilert
Am 21.01.2017 19:46, schrieb Benoît Minisini:
> Le 17/01/2017 à 08:26, Rolf-Werner Eilert a écrit :
>>
>> Where does the webform store the values until the next call? And can it
>> remember calls from different users?
>>
>> Regards
>> Rolf
>>
>
> This is exactly what is named a "session".
>
> A session in Gambas is a collection that is associated with an HTTP cookie.
>
> With gb.web.form, the session is automatically created for each user
> that connect to the application. It automatically remembers the
> variables associated with the webforms.
>
> It is up to you to implement a login/password check to identify the
> user, and modify your application according to its rights.
>
> Regards,
>


Ah, very interesting concept. So if I don't want a personal check, I can 
rely on the webform to automagically serve different users. :)

Regards
Rolf


--
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] variable in WebForm not remember

2017-01-21 Thread Benoît Minisini
Le 17/01/2017 à 08:26, Rolf-Werner Eilert a écrit :
>
> Where does the webform store the values until the next call? And can it
> remember calls from different users?
>
> Regards
> Rolf
>

This is exactly what is named a "session".

A session in Gambas is a collection that is associated with an HTTP cookie.

With gb.web.form, the session is automatically created for each user 
that connect to the application. It automatically remembers the 
variables associated with the webforms.

It is up to you to implement a login/password check to identify the 
user, and modify your application according to its rights.

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] variable in WebForm not remember

2017-01-16 Thread Rolf-Werner Eilert
Am 16.01.2017 01:37, schrieb Benoît Minisini:
> Le 16/01/2017 à 01:20, מיוסט שרון a écrit :
 hello

 I have WebForm1
 I put on the WebForm1 two controls of WebButton1 WebButton2
 I have a variable of type String named my_A
 I would like when I press the WebButton1 the my_A = "sharon" and when I 
 click on
 WebButton2 I want to get the value found in my_A


 The problem that when I click on WebButton2
 The value of the variable my_A is empty ""

 It's what's inside that WebForm1.class

 ' Gambas class file

 Export
 Private my_A As String

 Public Sub WebButton1_Click()

my_A = "sharon"

 End

 Public Sub WebButton2_Click()

WebButton2.Text = my_A

 End

>>>
>>> Yes, this is the main difference between a "normal" application (one
>>> process that runs continuously) and a "webform" application (one process
>>> by request).
>>>
>>> With a web application, the only way to keep things persistent is using
>>> the Session object.
>>>
>>> With a WebForm, you can store permanent things by using it like an
>>> array, which use internally the Session object of course.
>>>
>>> So you can write:
>>>
>>> Export
>>>
>>> Public Sub WebButton1_Click()
>>>
>>> Me["my_A"] = "sharon"
>>>
>>> End
>>>
>>> Public Sub WebButton2_Click()
>>> 
>>> WebButton2.Text = Me["my_A"]
>>>
>>> End
>>>
>>> So, never forget that your application is a web application that is not
>>> persistent between two events (the request is mostly the full handling
>>> of one event coming from the web browser. The response is the refresh of
>>> the web browser contents).
>>>
>>> Regards,
>>>
>>> --
>>> Benoît Minisini
>>
>>
>> Thank you it works
>>
>>
>>
>> I have another question that code:
>>
>> ' Gambas class file
>>
>> Export
>>
>> Public Sub WebButton1_Click()
>>Dim hWeb As WebButton
>>
>>WebButton1.Text = "btn1_text"
>>WebButton1.Tag = "btn1_tag"
>>Me["my_A"] = WebButton1
>>
>>hweb = Me["my_A"]
>>WebTextBox1.Text = hWeb.Text
>>WebTextBox2.Text = hWeb.Tag
>> End
>>
>> Public Sub WebButton2_Click()
>>Dim hWeb As WebButton
>>
>>hWeb = Me["my_A"]
>>WebTextBox1.Text = hWeb.Text
>>WebTextBox2.Text = hWeb.Tag
>> End
>>
>>
>> WebButton1 the event of a hWeb this is fine value of WebButton1
>> But the event of WebButton2 value of hWeb get "NULL"
>>
>
> Not everything can be stored in the session. Especially object
> references (as they are valid only in the same process).
>
> You can put in a "WebForm variable" (i.e. Me[xxx]) : booleans, numbers,
> strings, dates, variant, arrays and collections.
>
> I hope I will be able to start writing the documentation of the
> gb.web.form component soon.
>
> Regards,
>

Where does the webform store the values until the next call? And can it 
remember calls from different users?

Regards
Rolf


--
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] variable in WebForm not remember

2017-01-15 Thread Benoît Minisini
Le 16/01/2017 à 01:20, מיוסט שרון a écrit :
>>> hello
>>>
>>> I have WebForm1
>>> I put on the WebForm1 two controls of WebButton1 WebButton2
>>> I have a variable of type String named my_A
>>> I would like when I press the WebButton1 the my_A = "sharon" and when I 
>>> click on
>>> WebButton2 I want to get the value found in my_A
>>>
>>>
>>> The problem that when I click on WebButton2
>>> The value of the variable my_A is empty ""
>>>
>>> It's what's inside that WebForm1.class
>>>
>>> ' Gambas class file
>>>
>>> Export
>>> Private my_A As String
>>>
>>> Public Sub WebButton1_Click()
>>>
>>>   my_A = "sharon"
>>>
>>> End
>>>
>>> Public Sub WebButton2_Click()
>>> 
>>>   WebButton2.Text = my_A
>>>
>>> End
>>>
>>
>> Yes, this is the main difference between a "normal" application (one
>> process that runs continuously) and a "webform" application (one process
>> by request).
>>
>> With a web application, the only way to keep things persistent is using
>> the Session object.
>>
>> With a WebForm, you can store permanent things by using it like an
>> array, which use internally the Session object of course.
>>
>> So you can write:
>>
>> Export
>>
>> Public Sub WebButton1_Click()
>>
>>Me["my_A"] = "sharon"
>>
>> End
>>
>> Public Sub WebButton2_Click()
>>  
>>WebButton2.Text = Me["my_A"]
>>
>> End
>>
>> So, never forget that your application is a web application that is not
>> persistent between two events (the request is mostly the full handling
>> of one event coming from the web browser. The response is the refresh of
>> the web browser contents).
>>
>> Regards,
>>
>> --
>> Benoît Minisini
>
>
> Thank you it works
>
>
>
> I have another question that code:
>
> ' Gambas class file
>
> Export
>
> Public Sub WebButton1_Click()
>   Dim hWeb As WebButton
>
>   WebButton1.Text = "btn1_text"
>   WebButton1.Tag = "btn1_tag"
>   Me["my_A"] = WebButton1
>
>   hweb = Me["my_A"]
>   WebTextBox1.Text = hWeb.Text
>   WebTextBox2.Text = hWeb.Tag
> End
>
> Public Sub WebButton2_Click()
>   Dim hWeb As WebButton
>
>   hWeb = Me["my_A"]
>   WebTextBox1.Text = hWeb.Text
>   WebTextBox2.Text = hWeb.Tag
> End
>
>
> WebButton1 the event of a hWeb this is fine value of WebButton1
> But the event of WebButton2 value of hWeb get "NULL"
>

Not everything can be stored in the session. Especially object 
references (as they are valid only in the same process).

You can put in a "WebForm variable" (i.e. Me[xxx]) : booleans, numbers, 
strings, dates, variant, arrays and collections.

I hope I will be able to start writing the documentation of the 
gb.web.form component soon.

Regards,

-- 
Benoît Minisini

--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] variable in WebForm not remember

2017-01-15 Thread מיוסט שרון
> > hello
> >
> > I have WebForm1
> > I put on the WebForm1 two controls of WebButton1 WebButton2
> > I have a variable of type String named my_A
> > I would like when I press the WebButton1 the my_A = "sharon" and when I 
> > click on
> > WebButton2 I want to get the value found in my_A
> >
> >
> > The problem that when I click on WebButton2
> > The value of the variable my_A is empty ""
> >
> > It's what's inside that WebForm1.class
> >
> > ' Gambas class file
> >
> > Export
> > Private my_A As String
> >
> > Public Sub WebButton1_Click()
> >
> >   my_A = "sharon"
> >
> > End
> >
> > Public Sub WebButton2_Click()
> > 
> >   WebButton2.Text = my_A
> >
> > End
> >
> 
> Yes, this is the main difference between a "normal" application (one 
> process that runs continuously) and a "webform" application (one process 
> by request).
> 
> With a web application, the only way to keep things persistent is using 
> the Session object.
> 
> With a WebForm, you can store permanent things by using it like an 
> array, which use internally the Session object of course.
> 
> So you can write:
> 
> Export
> 
> Public Sub WebButton1_Click()
> 
>Me["my_A"] = "sharon"
> 
> End
> 
> Public Sub WebButton2_Click()
>   
>WebButton2.Text = Me["my_A"]
> 
> End
> 
> So, never forget that your application is a web application that is not 
> persistent between two events (the request is mostly the full handling 
> of one event coming from the web browser. The response is the refresh of 
> the web browser contents).
> 
> Regards,
> 
> -- 
> Benoît Minisini


Thank you it works



I have another question that code:

' Gambas class file

Export

Public Sub WebButton1_Click()
  Dim hWeb As WebButton
  
  WebButton1.Text = "btn1_text"
  WebButton1.Tag = "btn1_tag"
  Me["my_A"] = WebButton1
  
  hweb = Me["my_A"]
  WebTextBox1.Text = hWeb.Text
  WebTextBox2.Text = hWeb.Tag
End

Public Sub WebButton2_Click()
  Dim hWeb As WebButton
  
  hWeb = Me["my_A"]
  WebTextBox1.Text = hWeb.Text
  WebTextBox2.Text = hWeb.Tag  
End


WebButton1 the event of a hWeb this is fine value of WebButton1
But the event of WebButton2 value of hWeb get "NULL"

--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] variable in WebForm not remember

2017-01-15 Thread Benoît Minisini
Le 15/01/2017 à 18:31, מיוסט שרון a écrit :
> hello
>
> I have WebForm1
> I put on the WebForm1 two controls of WebButton1 WebButton2
> I have a variable of type String named my_A
> I would like when I press the WebButton1 the my_A = "sharon" and when I click 
> on
> WebButton2 I want to get the value found in my_A
>
>
> The problem that when I click on WebButton2
> The value of the variable my_A is empty ""
>
> It's what's inside that WebForm1.class
>
> ' Gambas class file
>
> Export
> Private my_A As String
>
> Public Sub WebButton1_Click()
>
>   my_A = "sharon"
>
> End
>
> Public Sub WebButton2_Click()
>   
>   WebButton2.Text = my_A
>
> End
>

Yes, this is the main difference between a "normal" application (one 
process that runs continuously) and a "webform" application (one process 
by request).

With a web application, the only way to keep things persistent is using 
the Session object.

With a WebForm, you can store permanent things by using it like an 
array, which use internally the Session object of course.

So you can write:

Export

Public Sub WebButton1_Click()

   Me["my_A"] = "sharon"

End

Public Sub WebButton2_Click()

   WebButton2.Text = Me["my_A"]

End

So, never forget that your application is a web application that is not 
persistent between two events (the request is mostly the full handling 
of one event coming from the web browser. The response is the refresh of 
the web browser contents).

Regards,

-- 
Benoît Minisini

--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user