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

2006-08-02 Thread Peter Horsbøll Møller
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


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

2006-08-02 Thread Lars I. Nielsen (GisPro)

Hi Nicki,

Certainly :-)

   Dim i As SmallInt
   Dim WID As Integer
   Dim name As String
 
   For i = 1 To NumAllWindows()

   WID = WindowID(-i)
   If WindowInfo(WID,WIN_INFO_TYPE) = WIN_BUTTONPAD Then
   name = WindowInfo(WID,WIN_INFO_NAME)
   If WindowInfo(WID,WIN_INFO_OPEN) Then
   Print "BUTTONPAD, name = " + name + " is visible"
...

Showing and hiding buttonpads are done using the Alter ButtonPad 
statement, as such (hiding all buttonpads) :


   Dim i As SmallInt
   Dim WID As Integer
   Dim name As String
  
   For i = 1 To NumAllWindows()

   WID = WindowID(-i)
   If WindowInfo(WID,WIN_INFO_TYPE) = WIN_BUTTONPAD Then
   name = WindowInfo(WID,WIN_INFO_NAME)
   If WindowInfo(WID,WIN_INFO_OPEN) Then
   Alter ButtonPad name Hide
...

Buttonpads are not normal windows, and FrontWindow() and Close Window 
can only be used on browsers, mappers, graph and layout windows.


Best regards / Med venlig hilsen
Lars I. Nielsen
GisPro



Nicki Cozens wrote:

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