Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Maze Solver - Updated Version 06 Oct 07

  1. #1

    Maze Solver - Updated Version 06 Oct 07

    Hello All,

    I'm posting an updated version of the Maze Solver application.

    I've tried to put in some re-sizing functionality, but I'm not sure if I did it correctly. It seems to work OK on my computer.

    Somehow, while modifying the code for the re-sizing, I believe I fixed the multiple re-draw problem. Don't know what I did that fixed it.

    Nothing else is new, but please try this version and let me know if the resizing works for you.

    I'll update the original post with this new version.

    Thanks,

    Randall

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Maze Solver - Updated Version 06 Oct 07

    Randall,

    more window refresh is still there but window resize is a great addition!

    I've "stiky" you post containing the source code (so it will always remain above all other posts) and added a note area to it so people knows when updates have taken place.

    Thanks a lot
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: Maze Solver - Updated Version 06 Oct 07

    Hi Randall,

    new version works perfectly !
    Just one thing - about dialog is opened twice ( ? ). When I click about box and then close, it re-appears. When I press close again, then it is gone as it should.
    The same applies to help file.

    But the new resizing feature is very good, and I think now it must work even in 640*480


    Thanks,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Maze Solver - Updated Version 06 Oct 07

    Double messages seems a bug in GetMessage function when used with notification structure.
    When used in standard way, GetMessage(hDlg, wParam, lParam), all seems ok.

    I will check UI module.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Maze Solver - Updated Version 06 Oct 07

    Can you please confirm that attached new thinBasic_UI.dll solve the double message firing?

    Thanks
    Eros
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Maze Solver - Updated Version 06 Oct 07

    Also this code should remove all multiple refreshing generated by the many %WM_PAINT and %WM_SIZE messages:

        CASE %WM_PAINT
         ClearMessages(hDlg)
         Call Paint_Grid_Window()
         Call Paint_Draw_Mode_Legend()
        CASE %WM_SIZE
         ClearMessages(hDlg)
         Call Dialog_Resize_Event_Handler()
    
    Last edited by ErosOlmi; 02-11-2015 at 21:50.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  7. #7

    Re: Maze Solver - Updated Version 06 Oct 07

    Quote Originally Posted by ErosOlmi
    Can you please confirm that attached new thinBasic_UI.dll solve the double message firing?
    Yes, I believe this fixes the multiple message firing. After installing, I did not get the "about", "open", and "save-as" dialogs appearing twice.

    Thanks Eros.

  8. #8

    Re: Maze Solver - Updated Version 06 Oct 07

    Quote Originally Posted by ErosOlmi
    Also this code should remove all multiple refreshing generated by the many %WM_PAINT and %WM_SIZE messages:

    [code=thinbasic]
    CASE %WM_PAINT
    ClearMessages(hDlg)
    Call Paint_Grid_Window()
    Call Paint_Draw_Mode_Legend()
    CASE %WM_SIZE
    ClearMessages(hDlg)
    Call Dialog_Resize_Event_Handler()
    [/code]
    I added this code and I do believe the multiple re-paints are gone. I'm so tired and bleary-eyed (as I was last night) that maybe I'm just not seeing it. Looks good to me.

    Thanks again, Eros!

  9. #9
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Maze Solver - Updated Version 06 Oct 07

    Randall,

    possibly, keep the original source code updated.
    Sorry for asking that, but it is important for all other users following your development on this nice example.

    Thanks a lot.
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Maze Solver - Updated Version 06 Oct 07

    Thanks to Maze Solver example I've also improved calling of API functions.
    In your script I saw the following code:

    function Draw_Grid() as long
      dim col_count  as dword
      dim row_count  as dword
      dim x1,x2,y1,y2 as dword
      dim pt     as POINT_TYPE
      
     
      SelectObject(hdc, GetStockObject(%BLACK_PEN) )
      
      'x2 = gridRight
      for row_count = 0 to astar_RowCount
       x1 = gridLeft
       y1 = gridTop + (row_count * cellHeight)
       MoveToEx(hdc,x1,y1,pt)
       y2 = y1
       LineTo(hdc,gridRight,y2)
      next
      
      'y2 = gridBottom
      for col_count = 0 to astar_ColumnCount
       x1 = gridLeft + (col_count * cellWidth)
       y1 = gridTop
       MoveToEx(hdc,x1,y1,pt)
       x2 = x1
       LineTo(hdc,x2,gridBottom)
      next
      
    end function
    
    Now, you defined "DIM pt as POINT_TYPE" only because "MoveToEx" need a POINT_TYPE structure. In other languages you can pass both a structure BYREF or a value representing the memory address where the structure is located. From next preview version this will be possible also in thinBasic, that is if parser will find a structure, its memory address will be passed otherwise if parser will find a numeric expression, the result of the numeric expression will be passed. In this way script can be
    [code=thinbasic]

    MoveToEx(hdc,x1,y1,%NULL) '---Here %NULL means no UDT is passed

    [/code]
    or
    [code=thinbasic]

    MoveToEx(hdc,x1,y1,0) '---Here 0 means no UDT is passed

    [/code]
    without the need to declare a structure.

    Feature will be present in next thinBasic preview 1.4.0.1 release

    Regards
    Eros
    Last edited by ErosOlmi; 02-11-2015 at 21:49.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Page 1 of 2 12 LastLast

Similar Threads

  1. Maze Solver - A-Star Path Finding
    By Randall in forum AStar - (A Star) path-finding algorithm
    Replies: 22
    Last Post: 05-10-2007, 03:00

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •