Search found 1106 matches

by cogier
Sunday 5th March 2023 3:39pm
Forum: Lounge
Topic: A nice video of a bit of computing history
Replies: 2
Views: 4761

Re: A nice video of a bit of computing history

Well worth a look. Thanks.
by cogier
Sunday 5th March 2023 11:18am
Forum: Beginners
Topic: Finding a value within an array
Replies: 3
Views: 1195

Re: Finding a value within an array

There is an easy way to do this: -

Public Sub Form_Open()

  Dim ar As Integer[] = [5, 6, 4, 7, 3, 8, 2, 9, 1, 0]

  Print ar.Find(3)  ''Result = 4
  Print ar.Find(6)  ''Result = 1

End


There is a lot you can do with arrays. Have a look ]here.
by cogier
Friday 3rd March 2023 3:14pm
Forum: Lounge
Topic: ChatGPT: something to play with over Christmas
Replies: 8
Views: 17333

Re: ChatGPT: something to play with over Christmas

I now have access to the Bing AI. Here is my first question and the answer. The code works without modification! https://www.cogier.com/gambas/Bing_AI_1.png This is the code: - Public Sub Button1_Click() Dim i As Integer Dim s As String s = "" For i = Asc("A") To Asc("Z"...
by cogier
Sunday 26th February 2023 4:56pm
Forum: Beginners
Topic: mouseclick with keypress
Replies: 6
Views: 849

Re: mouseclick with keypress

ControlKey is a constant (16777249), always TRUE !! Be careful as this will change depending on whether you are using GTK or QT. I quote here : - Never compare the value of this property with a numeric constant, because the key codes may depend on the underlying toolkit. Always use the constants de...
by cogier
Sunday 26th February 2023 2:19pm
Forum: Beginners
Topic: mouseclick with keypress
Replies: 6
Views: 849

Re: mouseclick with keypress

Hi Bert. Try the attached code. The problem as I see it is that you are trying to grab 2 events at the same time, this does seem to work though. Some help is available here . bMouseDown As Boolean TableView1 As TableView Public Sub Form_Open() With Me .Width = 500 .Height = 500 .Arrangement = Arrang...
by cogier
Wednesday 22nd February 2023 3:34pm
Forum: Component
Topic: DBus logout/shutdown Inhibitor
Replies: 2
Views: 3141

Re: DBus Inhibitor

Can I suggest you look at how others do this. I downloaded the source code for the text editor Gedit , did a search for 'inhibit' and came up with this. } if (can_close && (priv->inhibition_cookie != 0)) { gtk_application_uninhibit (GTK_APPLICATION (g_application_get_default ()), priv->inhib...
by cogier
Sunday 19th February 2023 3:36pm
Forum: Beginners
Topic: Enumerations
Replies: 4
Views: 4640

Re: Enumerations

I can't get Bruce's code to work. This is a little simpler if it helps.

Public Sub Form_Open()

  Dim MyArray As Integer[] = [5, 4, 7, 8, 9, 1, 2, 0, 3, 6, 5, 8, 7]
  Dim iInt As Integer

  For Each iInt In MyArray
    Print iInt
  Next

End


Image
by cogier
Saturday 18th February 2023 11:04am
Forum: General
Topic: Unable to install from software farm - Unknown Arc format?
Replies: 5
Views: 4673

Re: Unable to install from software farm - Unknown Arc format?

I tried to access this program on the Farm and got exactly the same error message for both ' Download ' and ' Download and install ' options. I managed to get the program running by downloading the file from the Farm via Gambas.one here , uncompressing the file, then opening it with Gambas. https://...
by cogier
Monday 13th February 2023 2:52pm
Forum: General
Topic: Good practices to ask sudo password in GUI ?
Replies: 9
Views: 4171

Re: Good practices to ask sudo password in GUI ?

I did it a try. It works, but it's not very good for security.
You are right, but I didn't create this to be super secure.
Why the command is executing twice?
This is done to catch any errors, try putting the wrong password in or a command that can't work.
by cogier
Sunday 12th February 2023 10:44am
Forum: General
Topic: Good practices to ask sudo password in GUI ?
Replies: 9
Views: 4171

Re: Good practices to ask sudo password in GUI ?

You could have a look at my program Sudo_solution that is on the Gambas Farm and available here

Image