Announcement

Collapse
No announcement yet.

Detect mouse hovering over command button?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Detect mouse hovering over command button?

    I'm trying to display in the statusbar the value of a global, but only when the mouse is moved over the "download" button.

    Here's an outline of what I've got. (All the rest of the code in the callback works fine, so I'm only showing what's NOT working.)

    Code:
    CallBack Function DlgProc() As Long
    
    LOCAL whatever... 
                ...
    
       Select Case CbMsg
       Case %wm_initdialog
    	...
       Case %wm_command
          'example of other stuff that works just fine:
          If Cb.Ctl = %CMD_Clear And Cb.CtlMsg = %bn_clicked Then
             SendMessage hList, %LB_RESETCONTENT, 0, 0   
          End If
    
    	...
    
       Case %wm_mousehover
          'show storage location when mouse moves over Download button
          If Cb.Ctl = %CMD_DownloadFiles Then 
             Statusbar Set Text hDlg, %SB_statusbar, 1, 0, "Current storage location: " & gStorageLocation
          End If
       Case %wm_mouseleave
          If Cb.Ctl = %CMD_DownloadFiles Then 
             Statusbar Set Text hDlg, %SB_statusbar, 1, 0, ""
          End If
    
       Case %wm_destroy
    	...
       End Select
    Do I need to enable something else, before a %wm_mousehover can be detected?


    P.S. I have no idea how this message got that thumbs up icon...???
    Last edited by John Montenigro; 18 Feb 2009, 08:37 AM. Reason: noticed that this message has an icon...

  • #2
    I'm glad you asked, because I was just today testing mouse detection and noticed the same trouble. In my case, no matter what control I put on the dialog, the mouse activity is not detected when the mouse is moved over a control - only when the mouse is over the dialog

    In your case, you tried to detect movement over a specific control. In mine, I didn't even try to filter the control. So as you've asked, there must be something else required to let the mouse movement be detected.

    I wasn't going to work on the problem today, but now that you've asked, I'll get to piggy-back and see the answer. Yeah!

    Code:
       #Compile Exe
       Global hDlg As Dword, DArray() As String
       Function PBMain() As Long
          Dialog New Pixels, 0, "Button Test",300,300,200,200, _
                                          %WS_SysMenu, 0 To hDlg
          Control Add Label, hDlg, 200,"<enter>", 10,10,100,20, %WS_Border   Call dlgproc
          Control Add Button, hDlg, 250,"<enter>", 130,10,50,50, %WS_Border   Call dlgproc
          Control Add TextBox, hDlg, 300,"<enter>", 10,50,100,20, %WS_Border Or %SS_Notify Call dlgproc
          Control Add TextBox, hDlg, 400,"<enter>", 10,90,100,20, %WS_Border Call dlgproc
          Control Add ListBox, hDlg, 500, Darray(), 10,130,100,60, %WS_Border Call dlgproc
          Dialog Show Modal hDlg Call DlgProc
       End Function
    
       CallBack Function DlgProc() As Long
          Static i As Long
          i+=1
          Select Case Cb.Msg
            Case %WM_Command
    '            Control Set Text hDlg, 200, "wm_command"
            Case %WM_KeyDown
                Control Set Text hDlg, 200, Str$(i) + " keydown"
            Case %WM_KeyUp
                Control Set Text hDlg, 200, Str$(i) + " keyup"
            Case %WM_SysKeyDown
                Control Set Text hDlg, 200, Str$(i) + " syskeydown"
            Case %WM_SysKeyUp
                Control Set Text hDlg, 200, Str$(i) + " syskeyup"
            Case %WM_LButtonDown
                Control Set Text hDlg, 200, Str$(i) + " lbuttondown"
            Case %WM_LButtonUp
                Control Set Text hDlg, 200, Str$(i) + " lbuttonup"
            Case %WM_LButtonDblClk
                Control Set Text hDlg, 200, Str$(i) + " lbuttondblclick"
            Case %WM_RButtonDown
                Control Set Text hDlg, 200, Str$(i) + " rbuttondown"
            Case %WM_RButtonUp
                Control Set Text hDlg, 200, Str$(i) + " rbuttonup"
            Case %WM_RButtonDblClk
                Control Set Text hDlg, 200, Str$(i) + " rbuttondblclick"
            Case %WM_MouseMove
                Control Set Text hDlg, 200, Str$(i) + " mousemove"
          End Select
       End Function
    Last edited by Gary Beene; 18 Feb 2009, 08:55 AM.

    Comment


    • #3
      Here's my guess (I hope this is all true, but I haven't spent time on the topic just yet):

      I'm assuming that we'll have to subclass the button.

      Normally, the Windows button class handles mouse actions - only passing mouse clicks to the application.

      But if we subclass the button, we get first look at all mouse actions even before the button class windows procedure gets it. After we're done, then we pass it on to the button class windows procedure for further processing (none, if we say so).

      Isn't that the general rule of thumb - Windows passes on some, but not all, messages to an application regarding events pertaining to windows in the application? Then, to get access to the normally-withheld messages, an application has to subclass to gain access to those usually-handled-by-Windows messages?

      Rats, John!

      I wasn't going to tackle subclassing today. Now you gone and messed up my plans!
      Last edited by Gary Beene; 18 Feb 2009, 09:04 AM.

      Comment


      • #4
        John,

        So, if what I said was true, how do we know which messages we get and which ones we have to subclass to receive?

        Again, here's my guess. If we go to MSDN for the button common control, there are notifications for click events, but NOT for mouse events.

        Here's the MSDN link for buttons:
        http://msdn.microsoft.com/en-us/library/bb775943(VS.85).aspx

        So I'm assuming that to receive any message not listed in the notification list, we have to subclass?

        I'm sure some of the more experienced forum guys will pop in momentarily with some guidance.

        I can't believe I posted 3 times without someone else stepping in. Did I miss the memo about a meeting going on?
        Last edited by Gary Beene; 18 Feb 2009, 09:19 AM.

        Comment


        • #5
          And if what I said is true, then the listing I created of "messages, notifications, styles, and extended styles for controls, windows, and other Windows objects that seem to be useful in PowerBASIC applications" might come in handy. It gives a listing of all the notifications listed in MSDN for all the PowerBASIC controls.

          I put an Excel file online at http://www.garybeene.com/files/named_constants_v3.xlsx

          Also, on each of the control pages at my website http://www.garybeene.com/power there is a listing for just that control.

          Comment


          • #6
            This may help

            I use the following:

            Code:
            LOCAL Mouse_Over_Ctrl as LONG
            SELECT CASE AS LONG CBMSG
                CASE %WM_SETCURSOR
            
                  Mouse_Over_Ctrl = GetDlgCtrlId(CBWPARAM)
                  SELECT CASE Mouse_Over_Ctrl
            
                    CASE %Your_Control_Id
                      'Set your statusbar text here
                  END SELECT
            END SELECT
            Last edited by Carlo Pagani; 18 Feb 2009, 09:32 AM.

            Comment


            • #7
              Well,
              "Never mind!" as Emily Litella used to say!

              John,
              Sorry for stepping in so much on this topic. It's one of high interest to me. Both for the answer itself and for why our learning materials didn't provide the answer or even a clue.

              Carlo!
              Well, that wasn't along the lines of the answer I was guessing at. Much simpler, and thanks!

              To the World-At-Large:
              I hate the part where some fundamental stuff we need to know has to be learned by asking. Asking is fine, but not for every question that comes up! So how would we newer-to-PowerBASIC folks have learned the answer Carlos gave? Without a mind-meld (perhaps that's what this forum is about?), I guess we'll just keep asking, experimenting, and studying - getting information piece-meal until we are well fed!

              Comment


              • #8
                I recommend the book Programming Windows by Charles Petzold. You will even find all the examples from this book converted to PowerBASIC in the Downloads section.
                Sincerely,

                Steve Rossell
                PowerBASIC Staff

                Comment


                • #9
                  Steve,
                  I've seen that recommendation before. Guess it's time to do a little deep reading. My local store didn't have it, so I guess I'll be ordering from Amazon.com.

                  Carlos/John,
                  I looked in my notifications summary spreadsheet and didn't find WM_SETCURSOR. I had notification listings for App, Common Control, Menu, Keyboard, Mouse and Specific Control classes - nothing on Cursor. It was there in MSDN, and in fact the ONLY notification in the Cursor topic there was WM_SETCURSOR! Wouldn't you know! I (wrongly) assumed Mouse notifications covered the world.

                  I'm still surprised that a Mouse notification didn't do the trick, but now I know. Like John's example code, I'd have bet on %wm_mousehover as the notification of interest. Even now, as I read the MSDN descriptions, the reason why mousehover didn't work is not obvious. I'll keep learning...

                  Thanks again for the information.

                  If anybody needs me, I'll be busy reading the Book!

                  Comment


                  • #10
                    Wow, Gary, this really did catch your attention! No problem with your hitting this thread, you've added a lot of depth to it. And, yes, I was in a meeting! Really!


                    OK, so thanks to Carlos {three cheers!}, I replaced my:
                    Code:
                       Case %wm_mousehover
                          'show storage location when mouse moves over Download button
                          If Cb.Ctl = %CMD_DownloadFiles Then 
                             Statusbar Set Text hDlg, %SB_statusbar, 1, 0, "Current storage location: " & gStorageLocation
                          End If
                    with:
                    Code:
                       Case %wm_SETCURSOR
                          If GetDlgCtrlId(CbWParam) = %CMD_DownloadFiles Then
                       
                          'show storage location when mouse moves over Download button
                    '      If Cb.Ctl = %CMD_DownloadFiles Then 'And Cb.CtlMsg = Then
                             Statusbar Set Text hDlg, %SB_statusbar, 1, 0, "Current storage location: " & gStorageLocation
                          End If
                    ...and it works just fine to set the message. Clearing the message is a different matter...

                    I haven't found a message to indicate that the mouse is no longer over the button, and my first inclination would be to test for

                    Code:
                          If GetDlgCtrlId(CbWParam) <> %CMD_DownloadFiles Then
                    but I have a suspicion that would be a disaster, as EVERYWHERE ELSE would satisfy that condition... (I can't imagine what a message storm that would set off...) So I'm going to keep searching for some hint somewhere...



                    You raised a number of other points about how to find information, and I noticed that even you had more insight than I did about where to start. You mentioned that you went "go to MSDN for the button common control".

                    Most times I "go to MSDN", I have no clue where to start, so I try various searches with keywords that I think are relevant. That strategy has a very low success rate. It might get me close, but I know I'll have hours of reading and browsing, and even then there's no guarantee I'll find an answer at all, let alone a clear answer, and forget about a relevant one! Often the information seems outdated, contradictory, or it applies to some other OS. (Like W2K or WinCE) (I relate to that name literally - I wince!) So, thanks for that link - if I took you off course today, you've just returned the favor!

                    I have tried diving into the MSDN heirarchial tree of topics, but their naming and organization of topics and subtopics is totally unintelligible to me. After someone points out a relevant page, I examine the "folder path" to see where it was nested, and invariably, I'm amazed and wondering "How'd anyone ever think to look under those topics?" I'm much better at cracking encryption by hand than I am at figuring out the MSDN's organization.


                    It's good that my question was a catalyst for you, and I appreciate your pointing me towards subclassing, another topic/technique that I need to learn. So thanks for the hints; hopefully I'll be able to work it out, if I'm ever capable of recognizing WHEN I might be in need of it...


                    I've tried the Petzold book and others, but recently a book by Newcombe and Rector was recommended to me as being "more gentle". I'm going to check it out.

                    I'll come back later for a look at your Excel list - today's slipping by and I haven't gotten much done. Darn meetings!

                    Comment


                    • #11
                      TrackMouseEvent Function
                      The TrackMouseEvent function posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time.
                      Furcadia, an interesting online MMORPG in which you can create and program your own content.

                      Comment


                      • #12
                        So I'm assuming that to receive any message not listed in the notification list, we have to subclass?

                        Isn't that the general rule of thumb - Windows passes on some, but not all, messages to an application
                        regarding events pertaining to windows in the application? Then, to get access to the normally-withheld
                        messages, an application has to subclass to gain access to those usually-handled-by-Windows messages?
                        Both quotes are incorrect. The second one is really bad. I will try to make some time to explain what I mean.
                        Dominic Mitchell
                        Phoenix Visual Designer
                        http://www.phnxthunder.com

                        Comment


                        • #13
                          Thanks Dominic.

                          I'll watch for your response. Nothing I've read clarified it for me, so I was hoping by stating my (really bad) understanding, that I'd get a correction - however painful a public thrashing might be!

                          Comment


                          • #14
                            Even if you keep discussing the possibilities..
                            In my experiance using a timer is one of the better options to determine mouseleave.
                            Frankly, i don't know why this message constant is available for us.

                            Note that for example a button has several states.
                            Often forgotten is the pressed state but mouse dragged outside the control's area and then back into it's area.
                            hellobasic

                            Comment


                            • #15
                              FromWin32 Programmer's Refence:
                              Tracking the Mouse Cursor

                              Windows-based applications often perform tasks that involve tracking the position of the mouse cursor. Most drawing applications, for example, track it during drawing operations, allowing the user to draw in a window's client area by dragging the mouse. Word-processing applications also track the cursor, enabling the user to select a word or block of text by clicking and dragging the mouse.

                              Tracking the cursor typically involves processing the WM_LBUTTONDOWN, WM_MOUSEMOVE, and WM_LBUTTONUP messages. A window determines when to begin tracking the cursor by checking the cursor position provided in the lParam parameter of the WM_LBUTTONDOWN message. For example, a word-processing application would begin tracking the cursor only if the WM_LBUTTONDOWN message occurred while the cursor was on a line of text, but not if it was past the end of the document.

                              A window tracks the position of the cursor by processing the stream of WM_MOUSEMOVE messages posted to the window as the mouse moves. Processing the WM_MOUSEMOVE message typically involves a repetitive painting or drawing operation in the client area. For example, a drawing application might redraw a line repeatedly as the mouse moves. A window uses the WM_LBUTTONUP message as a signal to stop tracking the cursor.
                              Now back to the comfort of DDT.

                              PS:

                              In my experience here Gary, when one doesn't get prompt replies, normally it's because someone with a ready answer hasn't read the query yet. And it usually takes 16 - 24 hours (longer on weekend) for all/most of the regulars to read the board due to the 24 zones involved.

                              ============================================
                              "I have an existential map;
                              it has 'you are here' written all over it."
                              Steven Wright
                              ============================================
                              Last edited by Gösta H. Lovgren-2; 18 Feb 2009, 06:33 PM.
                              It's a pretty day. I hope you enjoy it.

                              Gösta

                              JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                              LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                              Comment


                              • #16
                                Since Carlo beat me to it (as did everyone else, since I could not reply till now), I thought I would offer up the same solution (slightly modified, but also shows where "One solution, only brings up MORE questions") :wavey:

                                Demo shows a simulated download %Done
                                Code:
                                #COMPILE EXE
                                #DIM ALL
                                
                                '------------------------------------------------------------------------------
                                '   ** Includes **
                                '------------------------------------------------------------------------------
                                #IF NOT %DEF(%WINAPI)
                                    #INCLUDE "WIN32API.INC"
                                #ENDIF
                                '------------------------------------------------------------------------------
                                
                                '------------------------------------------------------------------------------
                                '   ** Constants **
                                '------------------------------------------------------------------------------
                                %IDD_DIALOG1 =  101
                                %IDC_BUTTON1 = 1001
                                %IDC_LABEL1  = 1002
                                '------------------------------------------------------------------------------
                                
                                '------------------------------------------------------------------------------
                                '   ** Declarations **
                                '------------------------------------------------------------------------------
                                DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
                                DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
                                '------------------------------------------------------------------------------
                                
                                '------------------------------------------------------------------------------
                                '   ** Main Application Entry Point **
                                '------------------------------------------------------------------------------
                                FUNCTION PBMAIN()
                                    ShowDIALOG1 %HWND_DESKTOP
                                END FUNCTION
                                '------------------------------------------------------------------------------
                                
                                '------------------------------------------------------------------------------
                                '   ** CallBacks **
                                '------------------------------------------------------------------------------
                                CALLBACK FUNCTION ShowDIALOG1Proc()
                                     STATIC hWndSaveFocus AS DWORD
                                     STATIC PercentDone AS LONG
                                     SELECT CASE AS LONG CBMSG
                                          CASE %WM_INITDIALOG                     ' Initialization handler
                                          CASE %WM_NCACTIVATE
                                               IF ISFALSE CBWPARAM THEN           ' Save control focus
                                                    hWndSaveFocus = GetFocus()
                                               ELSEIF hWndSaveFocus THEN          ' Restore control focus
                                                    SetFocus(hWndSaveFocus)
                                                    hWndSaveFocus = 0
                                               END IF
                                          CASE %WM_COMMAND                        ' Process control notifications
                                               SELECT CASE AS LONG CBCTL
                                                    CASE %IDC_BUTTON1
                                                         IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN MSGBOX "%IDC_BUTTON1=" + FORMAT$(%IDC_BUTTON1), %MB_TASKMODAL
                                                    CASE %IDC_LABEL1
                                
                                               END SELECT
                                          CASE %WM_SETCURSOR                       'change cursor
                                               SELECT CASE GetDlgCtrlId(CBWPARAM)
                                                    CASE %IDC_BUTTON1
                                                         CONTROL SET TEXT CBHNDL, %IDC_LABEL1, "% Done = " + STR$(PercentDone)
                                                         PercentDone = PercentDone + 1
                                                         IF PercentDone = 100 THEN PercentDone = 0
                                '                        MOUSEPTR 11                'Make a guess where this one leads? and why I purposely left out a value like %Hourglass instead of 11???? :-)
                                                         FUNCTION = 1
                                               END SELECT
                                          CASE ELSE
                                     END SELECT
                                END FUNCTION
                                '------------------------------------------------------------------------------
                                
                                '------------------------------------------------------------------------------
                                '   ** Dialogs **
                                '------------------------------------------------------------------------------
                                FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
                                    LOCAL lRslt AS LONG
                                    LOCAL hDlg  AS DWORD
                                    DIALOG NEW hParent, "Dialog1", 145, 88, 93, 48, %WS_POPUP OR %WS_BORDER _
                                        OR %WS_DLGFRAME OR %WS_THICKFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
                                        %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX OR %WS_CLIPSIBLINGS OR _
                                        %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR _
                                        %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR _
                                        %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
                                    CONTROL ADD BUTTON, hDlg, %IDC_BUTTON1, "Button1", 10, 5, 70, 20
                                    CONTROL ADD LABEL,  hDlg, %IDC_LABEL1, "Label1", 5, 35, 70, 10
                                    DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
                                    FUNCTION = lRslt
                                END FUNCTION
                                '------------------------------------------------------------------------------
                                Notice if you park the mouse pointer in one spot (either over the dialog, or the control) your label will NOT change until a mouse event?????

                                I ran a test but will digress so not to hijack this thread that any unhandled messages would not be processed??? (or must be subclassed to catch?)
                                Engineer's Motto: If it aint broke take it apart and fix it

                                "If at 1st you don't succeed... call it version 1.0"

                                "Half of Programming is coding"....."The other 90% is DEBUGGING"

                                "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                                Comment


                                • #17
                                  Oh by the way John
                                  I have tried diving into the MSDN heirarchial tree of topics, but their naming and organization of topics and subtopics is totally unintelligible to me. After someone points out a relevant page, I examine the "folder path" to see where it was nested, and invariably, I'm amazed and wondering "How'd anyone ever think to look under those topics?" I'm much better at cracking encryption by hand than I am at figuring out the MSDN's organization.
                                  Join the club....

                                  To me I search on obvious "KeyWords" and ideas, and when hitting that wall of ("It has to be documented somewhere??? What am I asking wrong???") and really starting to wonder if my brain is wired differently or WHAT???

                                  Problem is, when I mention it to the 1 person I can vent to without their eyes glazing over pretending to understand, within 10 seconds, they are like "Heres the link".

                                  After reading, I get it, but what I do NOT get is how the heck in 10 seconds and 1 google, can they find the MSDN doc that explains the problem? (Much less the doc I read has absolutely NOTHING to do with the problem, but explains the cause of the problem in a totally non related subject???????)

                                  makes one wanna go *HUH??????*
                                  Engineer's Motto: If it aint broke take it apart and fix it

                                  "If at 1st you don't succeed... call it version 1.0"

                                  "Half of Programming is coding"....."The other 90% is DEBUGGING"

                                  "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                                  Comment


                                  • #18
                                    Carlo's solution works great. Haven't tried Cliff's example.

                                    '
                                    Code:
                                    'PBWIN 9.00 - WinApi 05/2008 - XP Pro SP3
                                    #Dim All 
                                    #Compile Exe  
                                    #Include "WIN32API.INC"
                                    #Include "COMDLG32.INC"
                                    #Include "InitCtrl.inc"
                                    '
                                    Global hdlg As Dword                
                                    %Id_Exit_Btn = 1000
                                    %Id_Sample_Textbox = 1001
                                    %Id_Show_Result_Btn = 1002         
                                    %Id_Mouse_Label = 1003
                                    '
                                    ' 
                                    Macro Common_Locals 'Macro easier than retyping and maintains coding consistency
                                      Global Dlg_hght, Dlg_Wd As Long 'Global in case want to use in Controls
                                      Local Font_Handle, Row, col, hght, wd, Longest,ctr, ln, ln1, i As Long
                                      Local  l, s As String
                                    End Macro  
                                    '
                                    CallBack Function Dialog_Processor              
                                      Common_Locals
                                      Select Case CbMsg     'This is TO determine the message TYPE 
                                         '       
                                         Case %WM_INITDIALOG'<- Initialiaton when the program loads 
                                         '
                                         Case %WM_SYSCOMMAND 'Traps Any Alt key but only F4 closes              
                                         '
                                         Case %WM_MOUSEMOVE 
                                             s$ = Right$("0000" & Hex$(CB.lParam), 8)
                                             Row = Val("&H" & Left$(s$, 4))
                                             Col = Val("&H" & Right$(s$, 4))
                                             Control Set Text CB.Hndl, %Id_Mouse_Label, "  It Moved! {said a worried George}" & Using$(" Col ####     Row ####", Col, Row) 
                                         '
                                          'Carlo's sample
                                          Local Mouse_Over_Ctrl As Long
                                          Case %WM_SETCURSOR
                                             Mouse_Over_Ctrl = GetDlgCtrlId(CbWParam)
                                             Select Case Mouse_Over_Ctrl
                                               Case %Id_Mouse_Label
                                                Control Set Text CB.Hndl, %Id_Mouse_Label, " Over the Mouse Label"
                                               Case Else 
                                                Control Set Text CB.Hndl, %Id_Mouse_Label, " Elsewhere" & Str$(Mouse_Over_Ctrl)
                                             End Select
                                     
                                         '
                                         Case %WM_COMMAND  'This processes command messages
                                           Select Case CbCtl
                                             Case %Id_Show_Result_Btn 
                                                Control Get Text CbHndl, %Id_Sample_Textbox To l$
                                                  ? l$, , FuncName$
                                             Case %Id_Exit_Btn
                                               Select Case CbCtlMsg        
                                                  Case 0
                                                    Dialog End CbHndl 'Applikation beenden
                                               End Select
                                           End Select
                                      End Select
                                    End Function
                                    '
                                    Function PBMain
                                      Common_Locals
                                      Dlg_hght = 400
                                      Dlg_Wd = 400
                                      Dialog New Pixels, hdlg, "Demo", , , Dlg_Wd, Dlg_Hght, %WS_SYSMENU To hdlg 'centered
                                      Row = 10
                                      col = 10
                                      Wd = 40
                                      Hght = 12
                                      Control Add Label, hdlg, -1, " Name & Address ", Col, Row, Wd, Hght
                                     
                                      s$ = "Hagstrom, Borje" & $CrLf & _
                                           "123 PBWin Avenue" & $CrLf & _
                                           "PowerBasic, FL 12345"
                                     
                                      Col = Col + Wd + 10 'just past label 
                                      Hght = 15 * 10 'Plenty room for 10 lines of text
                                      Wd = Dlg_Wd - 40 - 30 'minus the label and leave a little
                                      Control Add TextBox, hdlg, %Id_Sample_Textbox, s$, Col, Row, Wd, Hght, %ES_WantReturn Or %ES_MultiLine
                                     
                                       Wd = Dlg_Wd - 20
                                       Col = 10 'center
                                       Row = Row + Hght + 20
                                       hght = 25   
                                       Control Add Label, hdlg, %Id_Mouse_Label, "Mouse Location                x", Col, Row, Wd, Hght, %SS_NOTIFY
                                      Font New "Comic Sans MS", 12 To Font_Handle
                                      Control Set Font hDlg, %Id_Mouse_Label, Font_Handle
                                       Row = Dlg_hght - (Hght * 2) - 4 'Just off bottom
                                         Control Add Button, hdlg, %Id_Show_Result_Btn, "Show Textbox Results", col, row, Wd, Hght
                                       Row = Dlg_hght - Hght - 2 'Just off bottom
                                         Control Add Button, hdlg, %Id_Exit_Btn, "Abandon Ship", col, row, Wd, Hght
                                     
                                         Dialog Show Modal hDlg   Call Dialog_Processor
                                    End Function  'Applikation beenden
                                    '
                                    ======================================
                                    "But at my back I always hear
                                    Time's winged chariot hurrying near."
                                    Andrew Marvell (1621-1678)
                                    ======================================
                                    Last edited by Gösta H. Lovgren-2; 19 Feb 2009, 03:12 PM. Reason: Update to catch Label
                                    It's a pretty day. I hope you enjoy it.

                                    Gösta

                                    JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                                    LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                                    Comment


                                    • #19
                                      Style needed

                                      Hi Gösta

                                      You need a %SS_NOTIFY style to work with labels

                                      Comment


                                      • #20
                                        Originally posted by Carlo Pagani View Post
                                        Hi Gösta

                                        You need a %SS_NOTIFY style to work with labels
                                        Right on Carlo. I edited the code above.

                                        =============================================================
                                        "It is an infantile superstition of the human spirit
                                        that virginity would be thought a virtue
                                        and not the barrier that separates ignorance from knowledge."
                                        -- Voltaire
                                        =============================================================
                                        It's a pretty day. I hope you enjoy it.

                                        Gösta

                                        JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                                        LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                                        Comment

                                        Working...
                                        X