Re: [Gambas-user] Using Character constants in Gambas

2011-03-08 Thread Caveat
I would just create a Module called something like DialogFactory...

PUBLIC ErrorDialog AS Integer = 0
PUBLIC WarningDialog AS Integer = 1
PUBLIC InformationDialog AS Integer = 2
PRIVATE DefaultDialogType AS Integer = ErrorDialog
PRIVATE AllowedTypes AS Integer[] = [ErrorDialog, WarningDialog,
InformationDialog]

PUBLIC FUNCTION getDialog(dialogType AS Integer) AS VikramDialog
  
  DIM vDialog AS NEW VikramDialog
  DIM type AS Integer
  FOR EACH type IN AllowedTypes
IF type = dialogType
  vDialog.dialogType = dialogType
  RETURN vDialog
END IF
  NEXT
  PRINT ERROR!  Unknown dialog type:   dialogType
  vDialog.dialogType = DefaultDialogType
  RETURN vDialog
END


Using this code simply becomes:

  DIM aDialog AS VikramDialog
  aDialog = DialogFactory.getDialog(DialogFactory.InformationDialog)
  PRINT aDialog.dialogType
  aDialog = DialogFactory.getDialog(DialogFactory.WarningDialog)
  PRINT aDialog.dialogType
  aDialog = DialogFactory.getDialog(5)
  PRINT aDialog.dialogType


Of course, you can add other stuff to the getDialog function, like the
dialog name, title etc. etc...

What do you think?

Regards,
Caveat

On Mon, 2011-03-07 at 23:09 -0800, vikram wrote:
 Hi,
 
 I am working on an application in which I reuse the same dialog for 
 performing different tasks. I have a PUBLIC INTEGER variable(named 
 dialogType) in the dialog's .class file. When creating instances of this 
 dialog I set the DialogInstance.dialogType to the value(0,1,2,...) which 
 indicates the purpose of the dialog. The value of DialogInstance.dialogType 
 is used within the dialog to decide what to do with the user input.
 
 I am using numeric values to indicate the dialog type. This isn't very 
 elegant. I am looking for the Gambas equivalent of doing a #define CHARCONST 
 value in C.
 
 I have tried using a Collection.
 
 DIM DialogType AS NEW Collection
 DialogType[SomeType0] = 0
 DialogType[SomeType1] = 1
 DialogType[SomeType2] = 2
 DialogType[SomeType3] = 3
 DialogType[SomeType4] = 4
 
 I am thinking of placing the collection's definition in a Module and then 
 using it to replace the numeric constants:
 DIM DialogInstance as DialogName
 DialogInstance = NEW DialogName
 DialogInstance.dialogType = ModuleName.DialogType[SomeType0]
 'current code
 'DialogInstance.dialogType = 0
 
 Is there a better way of using character constants in Gambas?
 
 Gambas 2.21/Debian 6
 
 Thanks,
 Vikram Nair
 
 
 
   
 --
 What You Don't Know About Data Connectivity CAN Hurt You
 This paper provides an overview of data connectivity, details
 its effect on application quality, and explores various alternative
 solutions. http://p.sf.net/sfu/progress-d2d
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user



--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Text Boxes

2011-03-08 Thread k p
When doing the following:
TextLabel1.Text = i  TextBox1.Text iEQU   0

I expect a string in a text box, which I get.
However the length of the spacing stays the same no matter how many spaces I
put between the

What I'm trying to achieve is that the output string follows my coding
standard.
Ie if I write Callbutton in TextBox1, then the output shows
iCallbutton  iEQU  0

What am I doing wrong ?

Kim
--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Using Character constants in Gambas

2011-03-08 Thread vikram
Hi Caveat,

Thanks, that is a lot simpler :)

Best Regards,
Vikram Nair



  
--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Using Character constants in Gambas

2011-03-08 Thread vikram
Hi Caveat,

Thanks, that is a lot simpler :)

Best Regards,
Vikram Nair



  
--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Using Character constants in Gambas

2011-03-08 Thread Caveat
You're welcome :-)

I was thinking if you want your module to be used by others who may have
the bright idea of changing the public attributes, you should probably
code using the CONST keyword...it's also clearer that these values
should never be  changed...

PUBLIC CONST ErrorDialog AS Integer = 0
PUBLIC CONST WarningDialog AS Integer = 1
PUBLIC CONST InformationDialog AS Integer = 2
PRIVATE DefaultDialogType AS Integer = ErrorDialog
...


The following code will now produce a runtime error on the 2nd line:

  PRINT before:   DialogFactory.ErrorDialog
  DialogFactory.ErrorDialog = 5
  PRINT after:   DialogFactory.ErrorDialog

Regards,
Caveat


On Tue, 2011-03-08 at 03:07 -0800, vikram wrote:
 Hi Caveat,
 
 Thanks, that is a lot simpler :)
 
 Best Regards,
 Vikram Nair
 
 
 
   
 --
 What You Don't Know About Data Connectivity CAN Hurt You
 This paper provides an overview of data connectivity, details
 its effect on application quality, and explores various alternative
 solutions. http://p.sf.net/sfu/progress-d2d
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user



--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Date picker: reading single days (Gambas 2)

2011-03-08 Thread Rolf-Werner Eilert
Now, there is a minor thing that I came across when I tried to color 
days in the date picker: There can be more than 1 month, or even there 
will be in most cases, even 3 months is possible.

Is it possible to know which days from which month are currently shown 
in the control? Something like an array I can iterate through to decide 
if this day must be coloured?

Thanks for your ideas!

Rolf

--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Controlling mplayer while embeded...

2011-03-08 Thread Stephen Bungay
On 03/08/2011 09:04 AM, Stephen Bungay wrote:
  Anyone have an example of this? I have launched mplayer using exec
 and have it in an embedder, now want to control it through push buttons.

 --
 What You Don't Know About Data Connectivity CAN Hurt You
 This paper provides an overview of data connectivity, details
 its effect on application quality, and explores various alternative
 solutions. http://p.sf.net/sfu/progress-d2d
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user

OK, successfully sending a pause command to embedded mplayer, but it 
exits as soon as it is paused.

--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] String and textboxes

2011-03-08 Thread k p
 When doing the following:
 TextLabel1.Text = i  TextBox1.Text iEQU   0

 I expect a string in a text box, which I get.
 However the length of the spacing stays the same no matter how many spaces
I
 put between the

 What I'm trying to achieve is that the output string follows my coding
 standard.
 Ie if I write Callbutton in TextBox1, then the output shows
 iCallbutton  iEQU  0

 What am I doing wrong ?

 Kim


I'm not sure what you exactly do here in your program, but your example
above consists of string constants. You would have to vary the number of
spaces according to the length of the strings in TextBox1.Text, such as

space$(20 - string.len(TextBox1.Text))

to give just an example for UTF-8.

Or did I get you completely wrong here?

Regards

Rolf



What is happening is that white spaces does NOT change in the output
textbox, no matter how many white spaces I put in between the.
Ie   and  produces the same output in the text box.

So I get the following
iCallbutton iEQU 0

When I would expect this
iCallbutton  iEQU  0

Hmm

Kim
--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] String and textboxes

2011-03-08 Thread Simonart Dominique
Hi,

With Gambas2 v2.21 it works exactly as you want!
Tested with Label and TextBox

regards

Le 08/03/2011 20:11, k p a écrit :
 When doing the following:
 TextLabel1.Text = i   TextBox1.TextiEQU  0

 I expect a string in a text box, which I get.
 However the length of the spacing stays the same no matter how many spaces
 I
 put between the

 What I'm trying to achieve is that the output string follows my coding
 standard.
 Ie if I write Callbutton in TextBox1, then the output shows
 iCallbutton  iEQU  0

 What am I doing wrong ?

 Kim


 I'm not sure what you exactly do here in your program, but your example
 above consists of string constants. You would have to vary the number of
 spaces according to the length of the strings in TextBox1.Text, such as

 space$(20 - string.len(TextBox1.Text))

 to give just an example for UTF-8.

 Or did I get you completely wrong here?

 Regards

 Rolf



 What is happening is that white spaces does NOT change in the output
 textbox, no matter how many white spaces I put in between the.
 Ie   and  produces the same output in the text box.

 So I get the following
 iCallbutton iEQU 0

 When I would expect this
 iCallbutton  iEQU  0

 Hmm

 Kim
 --
 What You Don't Know About Data Connectivity CAN Hurt You
 This paper provides an overview of data connectivity, details
 its effect on application quality, and explores various alternative
 solutions. http://p.sf.net/sfu/progress-d2d
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user



--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Issue 48 in gambas: long lines wrap in search window

2011-03-08 Thread gambas
Status: New
Owner: 
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 48 by zachsmit...@gmail.com: long lines wrap in search window
http://code.google.com/p/gambas/issues/detail?id=48

1) long lines wrap in search window

2)
Version: TRUNK
Revision: r3617

Would it be better to not wrap and use a horizontal scroll bar instead?

Attachments:
Screenshot.png  96.3 KB
test23-0.0.1.tar.gz  4.4 KB


--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user