MapInfo Pro Developers User Group

Welcome to the MapInfo Pro Developers community!  We are a group dedicated to the discussion and understanding of MapBasic and .Net MapInfoPro AddIn development. Bring your questions and ideas here. This group includes several members of the Pro development team from around the world.

Please feel free to start a discussion in the discussion tab or join in a conversation.

Product Information  Ideas Portal  MapInfo Community Downloads

Discussions

Members

Resources

Events

 View Only
  • 1.  Possible bug with 'Shade' statement with MI v12.5 and higher?

    Posted 01-15-2018 16:50

    Hi all,

     

    not sure if 32-bit issues are still going to be looked in to, but for my peace of mind at least...

    Long story short, the following Shade statement is dynamically built up as a string and then executed as a run command:

    Shade triangles with colcode Values "1" Brush (1, 16711680) Pen (1, 2, 16711680), "2" Brush (1, 255) Pen (1, 2, 255), "3" Brush (1, 65280) Pen (1, 2, 65280) Default Symbol (34, 12632256, 6) Brush (2, 0) Pen (1, 2, 0)

    (16711680 = RED; 255 = BLUE; 65280 = GREEN)

    See Attachment

    Running the mbx (compiled and linked with MapBasic 8.5) with 8.5.1B I get the correct results, but incorrect results running with 15.0.1 (see picture). The solid blue triangles (value = 3) have a green outline (which is correct) but they shouldn't have a solid fill, and the green triangle (value = 2) has a blue outline (correct) but again it shouldn't have a solid fill. Compare that to the shade statement that produced these results where the colours specified for pen and brush are the same though.

     

    I've trailed through the code to see if there was anything else possibly happening after the first shade statement that could be overriding the first but am pretty confident this isn't the case, and then there's the fact that the same mbx being run by different instances of MapInfo produces different results.

    Is there anything anyone can think of that might be causing this?

    Cheers,

    Alex

     

    Attachment(s)

    zip
    triangles.zip   575 KB 1 version


  • 2.  RE: Possible bug with 'Shade' statement with MI v12.5 and higher?

    Employee
    Posted 01-15-2018 16:29
      |   view attached

    Could it be related to the Preference which controls the rendering of the base layer?

    You can find this under Map Options. It's called Draw Layer under Themes

    See Attachment

     

     



  • 3.  RE: Possible bug with 'Shade' statement with MI v12.5 and higher?

    Posted 01-16-2018 09:24

    Hi Peter!

    I didn't even even think of the possibility of this being down to preferences but that could explain the difference between the two MapInfos. I've toggled the Draw Layers Under Themes switch on and off (was off to start with - and restarted MapInfo each time) but unfortunately this hasn't made a difference.

    I have also now opened the triangles table in MapInfo 15 and then applied the shading via the mapbasic window - this does work and gives me all the right styles. Could a WinChangedHandler Off statement be interfering in some way? It must be something odd like that causing it...



  • 4.  RE: Possible bug with 'Shade' statement with MI v12.5 and higher?

    Employee
    Posted 01-16-2018 10:08
      |   view attached

    Hi Alex,

    I tried reproducing the issue with a very basic application that wraps your shade statement into a string and runs this using the Run Command statement.

    Dim sCmd As String

    sCmd = "Shade triangles with colcode Values "

       & Chr$(34) & "1" & Chr$(34) & " Brush (1, 16711680) Pen (1, 2, 16711680), "

       & Chr$(34) & "2" & Chr$(34) & " Brush (1, 255) Pen (1, 2, 255), "

       & Chr$(34) & "3" & Chr$(34) & " Brush (1, 65280) Pen (1, 2, 65280) "

       & " Default Symbol (34, 12632256, 6) Brush (2, 0) Pen (1, 2, 0)"

      Print sCmd

      Run Command sCmd

    I get good looking triangles with no fill as a result. Similar to what I get when running your shade statement from the MapBasic window.

    See Attachment

    I have attached my source code. Can you try to compile it and run it in v15.0.2 to see if you get the similar behaviour?

    How does your shade statement look in a string?



  • 5.  RE: Possible bug with 'Shade' statement with MI v12.5 and higher?

    Posted 01-17-2018 06:35

    Hi Peter,

    your script works in 15.0.1, as it does when running the Shade statement from the MapBasic window. Mine is pretty much identical to yours (see my first post), and I have also tried running this without the run command but still the same result.

    I've now altered the code in the main program so that the shade statement is hard-coded and bypasses the colour-coding sub (where the run command string is built up and executed based on the colour-code field the user has chosen) that we have and hurrah, it works both as a normal statement and run command. I'll have to trail through that sub (again) and find the culprit - there are all sorts of things going on in it so god knows what it might be but I'll let you know when I've found it.

    Probably shouldn't have cried 'bug!' then... although I'm still confused by the different behaviour between v8.5 and v12.5 and v15.