Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use command button to show/hide objects?

Status
Not open for further replies.

sodabunny

Technical User
Mar 31, 2003
17
GB
Hi,

I'm new to approach and I can't seem to find much assistance in constructing a new database from scratch. I know the basics of using databases from experience with access but there are a couple of things I can't seem to be able to do too easily in approach. Firstly accessing the code manager is ok but are there any guides on using it as it doesn't seeem as intuitive as access. Also how do I show / hide objects on a form on the click of a button. Last question, if I want to show selected fields on a form, as a dialogue box if necessary, is there the option to make it sizeable and set the screen position on opening.

I hope someone can assist me with this 'cos the Lotus help files only seem to apply to the basics.

Thanks

 
You'll find plenty more resources at including FAQs and free downloads of LotusScript samples.

Let's say you have a button and want to toggle its caption between Show/Hide when clicked and toggle the visibility of controls at the same.
Code:
Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)

 Dim intVisible As Integer 'No boolean data type in LotusScript, use Integer

 'Check the button caption, set the visiblity state
 intVisible = (Source.Text = "Show")

 With Source.Parent
  'This assumes the controls are within the same
  'panel as the button. Source.Parent returns the panel
  .fbxField1.Visible = intVisible
  .fbxField2.Visible = intVisible
  'and so on where fbxField1 is the object name of a
  'fieldbox for example
 End With

 'Set the button caption
 If intVisible Then
  Source.Text = "Hide"
 Else
  Source.Text = "Show"
 End If

End Sub

The LotusScript IDE is quite good when you get used to it. Is there anything particular you want to do that you can't find? There's a Lotus PDF in the Free Downloads at XpertSS, Developing SmartSuite Applications using LotusScript that has a chapter on the IDE.

If using Approach 9.5 or later use the Dialog Editor to create a dialog. A Lotus Dialog with LotusControls (these aren't the regular Approach controls) is very similar to a VB form.

See apr-dlgs.zip in the XpertSS Free Downloads for a working example.

Also at XpertSS, in the Approach | FAQS | Tips and Techniques folder, under the discussion Win32 API functions, see "How to centre a Lotus Dialog in the screen"

There's another way in Approach - create a regular form to use as a dialog and set it to Show As Dialog on the Macros tab of the form properties sheet. These are rather buggy both at design time (when adding unbound fields) and run time (crashing Approach). Again, see the item in the Tips folder, "Dialog form rules"

Lotus Dialogs were introduced in 9.5 and I recommend using them rather than "forms as dialog" You'll find the objects and coding more like VB and VBA too.

Paul Bent
Northwind IT Systems
 
Thanks Paul,

Those tips should help no end. I'll spend a bit of time looking into it.

Great speedy response.

Sodabunny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top