Title: RE: [MI-L] MapBasic - How to tell if a ButtonPad is Showing

Hi,

Here is a small function that will toggle the appearance of a named buttonpad. You can use this as inspiration ;-)

- ButtonPadInfo(name_of_buttonpad, BTNPAD_INFO_WINID)
will return the WindowID of the buttonpad
- WindowInfo(nWID, WIN_INFO_OPEN)
will, when used on a buttonpad, tell you if the buttonpad is shown (=true) or hidden (=false)

'************************************************************************
Sub PADShowHide(ByVal sPadName As String )

Dim     nWID As Integer

OnError GoTo ErrorOccured

        nWID = ButtonPadInfo(sPadName, BTNPAD_INFO_WINID)

        If WindowInfo(nWID, WIN_INFO_OPEN) Then
                Alter ButtonPad sPadName Hide
        Else
                Alter ButtonPad sPadName Show
        End If

'-------------------
ErrorOccured:

End Sub
'************************************************************************


Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis

"For enden af regnbuen..." - hvordan kommer man dertil og er det overhovedet muligt?
Læs mere om årets MapInfo konference på www.cowi.dk/mapinfokonference

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Nicki Cozens

Sent: Wednesday, August 02, 2006 10:23 AM
To: mapinfo-l@lists.directionsmag.com
Subject: [MI-L] MapBasic - How to tell if a ButtonPad is Showing

Re the posting on 07-21-2006 and reply by Lars I. Nielsen:

Do you have an example of how WindowInfo is used to find the Show/Hide status of a floating button bar? 

I'm struggling with showing and hiding a button pad. 

I create the button bar and make sure that it has show as one of the attributes. 

I then issue the command "buttonpad_id = FrontWindow()" to obtain the window id. 

I tried to then issue the "Set Window buttonpad_id Hide" but it said I couldn't do that to that kind of window, so I tried "Close Window buttonpad_id" instead and it would appear that when I used the

FrontWindow() command it was picking up the map window instead of the button pad I had just created as the map window closes and not the button pad.

Any suggestions as to what I am doing wrong?

Here is the code:

Create ButtonPad "Accept" As
        PushButton
                Icon 185
                HelpMsg "Click to accept when happy"
                Calling Accept_changes
        PushButton
                Icon 195
                HelpMsg "Click to reject"
                Calling reject_changes
        Width 3
        Position (2,2)
        Show
        Float

buttonpad_id = FrontWindow()

'The following would not work with the window in question 'Set Window buttonpad_id
'       Hide
Close Window buttonpad_id                               'this closed the
map window

Many thanks
Nicki

_______________________________________________________________________
Leicestershire County Council - rated a  'four-star' council by the Audit Commission _______________________________________________________________________


This e-mail and any files transmitted with it are confidential. If you are not the intended recipient, any reading, printing, storage, disclosure, copying or any other action taken in respect of this e-mail is prohibited and may be unlawful. If you are not the intended recipient, please notify the sender immediately by using the reply function and then permanently delete what you have received.

Incoming and outgoing e-mail messages are routinely monitored for compliance with Leicestershire County Council's policy on the use of electronic communications.   The contents of e-mails may have to be disclosed to a request under the Data Protection Act 1998 and the Freedom of Information Act 2000.

The views expressed by the author may not necessarily reflect the views or policies of the Leicestershire County Council.

Attachments to e-mail messages may contain viruses that may damage your system. Whilst Leicestershire County Council has taken every reasonable precaution to minimise this risk, we cannot accept any liability for any damage which you sustain as a result of these factors. You are advised to carry out your own virus checks before opening any attachment.



_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l



_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to