[Gambas-user] Inputbox

Matti math.eber at ...221...
Tue Aug 7 20:19:56 CEST 2012


Hmm. I don't have gb2 on my machine anymore, so I can't tell why it isn't centered.
Btw: you should update to gb3, it's much better!

Example code for a ShowModal window:

Create a form FMain with just two buttons (btnCancel and btnInput).
Then create a form FInput with the Text "What's your name?", a TextBox 
(TextBox1) and two buttons (btnCancel and btnOK).

The FMain code is:

Public Sub Form_Open()
   Me.Center
End

Public Sub btnCancel_Click()
   Me.Close
End

Public Sub btnInput_Click()
   FInput.ShowModal
   If Me.Tag = "" Then
       Print "User has cancelled."
     Else
       Print "The name is " & Me.Tag & "."
   Endif
End

The FInput code is:

Public Sub btnCancel_Click()
   FMain.Tag = ""
   Me.Close
End

Public Sub btnOK_Click()
   FMain.Tag = TextBox1.Text
   Me.Close
End

Easy, isn't it?



Am 07.08.2012 15:34, schrieb Cogier:
>
> Thanks for the reply Matti-4.
>
> I am using Gambas 2.23, Ubuntu 12.04, Gnome 3.
>
> Can you give me any example code of the 'xyz.ShowModal'?
>
> Thanks for any help.
>
>
> Matti-4 wrote:
>>
>> What is your Gambas version and your environment?
>> Here (Gambas 3, OpenSuse 12.1, KDE), the InputBox is correctly centered.
>>
>> But as a workaround, you can easily create a tiny form for the input and
>> open it
>> with 'xyz.ShowModal'. That is surely centered, and it takes about the same
>> amount of code.
>>
>>
>> Am 06.08.2012 10:15, schrieb Cogier:
>>>
>>> Is there a way to centre the InputBox on the screen as I always see it in
>>> the
>>> top left hand corner and it is missed by the user?
>>>





More information about the User mailing list