[Gambas-user] What is the use of Tag property

Michael mdavies5 at ...169...
Sun Dec 12 11:16:08 CET 2010


Select Case is not an alternative to a click event. In the example I 
gave you would use the following pseudo code:
SUB btnEdit_Click()
ME.Tag = "edit"
Populate text boxes with current data and enable them to be edited

SUB btnNew_Click
ME.Tag = "new"
Clear all text boxes and enable them to accept data.

SUB btnSave_Click
SELECT CASE ME.Tag
     CASE "edit'
         Update database with edited information
     CASE "new"
         Insert new record into database.
END SELECT
ME.Tag=""

In my example the TAG property is set to indicate the status of the 
application. If the user tried to close the form you would be aware that 
data was being changed and you could ask the user if they wanted to save 
the data before closing.
I hope this is clear.

Regards
Michael


On 12/12/10 19:32, Demosthenes Koptsis wrote:
> Ok i see.
>
> i used to use buttons event click for each one button and it is a bit
> strange to understand it.
>
> So if i understand right instead of click event you use a SELECT CASE
> for tag property?
>
>
>
> On Sun, 2010-12-12 at 10:22 +1100, Michael wrote:
>> If you want a practical example. I have a data form with Edit, Add and
>> Save buttons. When I click Edit or Add I set the tag property of the
>> form; it can be anything "add" "edit or "1" and "2". When the Save
>> button is clicked I then know which action to take. It's use is purely
>> at the developer's discretion. In a sense it works as a global variable
>> but is better because nobody likes globals.
>>
>> Regards
>> Michael
>>
>>
>> On 12/12/10 01:35, Demosthenes Koptsis wrote:
>>> PROPERTY Tag AS Variant
>>>
>>> Returns or sets the control tag.
>>>
>>> This property is intended for the programmer and is never used by the
>>> component. It can contain any Variant value.
>>> ------------------------------------------------
>>>
>>> ok but what is the use of this property?
>>>
>>>
>> ------------------------------------------------------------------------------
>> Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
>> new data types, scalar functions, improved concurrency, built-in packages,
>> OCI, SQL*Plus, data movement tools, best practices and more.
>> http://p.sf.net/sfu/oracle-sfdev2dev
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list