Hello Guest it is January 28, 2022, 04:58:18 AM

Author Topic: VB Dialogs and buttons  (Read 2640 times)

0 Members and 1 Guest are viewing this topic.

VB Dialogs and buttons
« on: May 16, 2010, 10:32:43 PM »
New here - been lurking for a while, and have learned much from a great number of generous contributors. Thank you all, already. I am attempting something that seems easy, but I can't get it to work. I have an EB (Cypress Enable Basic) script attached to an "Edit Text" button on my custom screen.

My problem is that any button press closes the dialog. I need a couple of buttons to set basic options, and need the dialog to remain open and reflect the changes, before the user chooses to accept or reject said changes...


Begin Dialog DlgMainInput 0,0,300,200,"Main Text Input Dialog"
OKButton 80,175,40,14
CancelButton 130,175,40,14
PushButton 180,175,40,14,"Reset"
Text 25,10,80,20,"Line 1 Prefix:"
TextBox 25,20,80,14,.tbLN1pre
Text 110,10,80,20,"Line 1 Body:"
TextBox 110,20,80,14,.tbLN1body
Text 195,10,80,20,"Line 1 Suffix:"
TextBox 195,20,80,14,.tbLN1suf
Text 25,45,80,20,"Line 2 Prefix:"
TextBox 25,55,80,14,.tbLN2pre
Text 115,62,80,20,"<<<Serial Portion>>>"
Text 195,45,80,20,"Line 2 Suffix:"
TextBox 195,55,80,13,.tbLN2suf
'   CheckBox 25,85,60,20,"Use 2 Lines", .Use2lines
'   CheckBox 25,100,90,20,"Fixed # of Serial Digits",.FixDig
PushButton 25,105,60,20, "Use 2 Lines"

End Dialog

Dim b As Integer
b=Dialog(DlgMainInput)  'ret val of button pressed
         '"2"="Use 2 Lines"

Dim a As DlgMainInput
'Message b
Select Case b

'Case -1 (OK) proves that any user text entered in "Line 1 Prefix" is written
'to the variable tbLN1pre

'Case 0 (Cancel) DOES NOT assign the input text to the variable

Case 1

Case 2
a.tbLN1pre ="Use what?"
End Select

Print a.tbLN1pre

Offline stirling

  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: VB Dialogs and buttons
« Reply #1 on: May 22, 2010, 03:08:24 AM »
Hi donmair and welcome to the forum. What you want can be done. Take a look at page 25 of the cypress man. I've enclosed the example they refer to to help you figure it out.