Results 1 to 17 of 17

Thread: [RESOLVED] Tile Cursor Interference (Cairo Overlays)

  1. #1

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Resolved [RESOLVED] Tile Cursor Interference (Cairo Overlays)

    Hi Cairo Squad,
    Probably another question for Olaf.

    Picture above, if it works(?) Here for the link https://www.dropbox.com/s/qziedzw75b...ursor.jpg?dl=0
    If you can see the picture, it has a tile cursor, which highlights the ground you are standing on.
    It helps you figure out where you are walking to, or where you place a brickwall for example.
    But, here's the problem, if you move your mouse ever so slightly onto the cursor itself, it blocks you.
    Ie: You can no longer touch the screen to walk anywhere, or drop objects.
    Basically, the cursor needs to be a ghost item, untouchable/un-clickable.
    I've been searching through the widgetbase F2 command for anything that resembles ghosting, but none of them appear to work, even AlphaNoInherit, which sounded close. As there is no documentation, anyone know what to do to make a ghost item?
    Thanks you.

  2. #2
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Tile Cursor Interference (Cairo Overlays)

    Quote Originally Posted by -Corso-> View Post
    ...here's the problem,
    if you move your mouse ever so slightly onto the cursor itself, it blocks you.
    Ie: You can no longer touch the screen to walk anywhere, or drop objects.
    Basically, the cursor needs to be a ghost item, untouchable/un-clickable.
    You have to keep in mind, that you have two TopLevel-Windows on your Windows-Screen
    (which are siblings on the Windows-Desktop):
    1) your Main-Form, where all "fast Cairo-Game-Renderings take place" (in a classical GameLoop)
    2) your fully transparent Overlay-Form (which sits on top of the Main-Form, and can host Widgets)

    Therefore Mouse-Clicks will only reach the underlying Main-Form, under one condition:
    - the OverlayForm (where the MouseClick or MouseMove happens first),
    ..has to have "a fully transparent Pixel at this MouseCoord"

    That's "Windows-rules" - not "Cairo-Rules".
    For that reason, it would be much better, when you'd integrate your Cursor-Handling into the "Scene-Renderloop" of your Main-Form!
    (via a few "State-Variables" like: CurrentHoveredTile or CurrentCursorTile or both.)

    You've probably implemented your "Cursor" as a Widget on the Overlay-Form.
    That's simply "the wrong place" (the wrong Window, spoken in "OS-terms") to handle this kind of thing.

    As for "making a Widget visible, but entirely click-through" -
    (mouse-events "falling through" to only the immediate ParentContainer of that Widget)...
    This could be done via the W_HitTest(...)-Event within a Widget-Class
    (in conjunction with enabling this mechanism first, via W.ImplementsHitTest = True)

    Code:
    Private Sub Class_Initialize()
      Set W = Cairo.WidgetBase
          W.ImplementsHitTest = True
    End Sub
    
    Private Sub W_HitTest(ByVal x As Single, ByVal y As Single, HitResultHit As Boolean)
      HitResultHit = False 'return False, if you want to make this Widget "click-through" (fully, or even in "certain areas only")
    End Sub
    But as said, the best you can achieve with that "HitTest-based kind of ghosting",
    is a "fall-through" of the MouseEvents to the outermost cWidgetForm-Container
    (in case the Widget in question was added as a direct child via cWidgetForm.Widgets.Add(...)).

    So, in your case it would be the cfOverlay.Form (of type cWidgetForm),
    which would "receive" the MouseEvents of such a HitTested=False-Widget, not the Main-Form.

    Ergo - move your Cursor- and Hover-State-renderings into the "normal Scene-RenderLoop" of your MainForm.
    That's the right place for that kind of thing.

    P.S. Looking at your "Widget-Panel-DemoCode" I've seen that you renamed all the "internal W-Variables of a Widget-Class" to a "specific name".
    That's not a good idea IMO, because it's an internal Private Variable which should be the same "on the inside of any Widget-Class" (steering the behaviour of said Widget).

    A WidgetClass is very similar to a VB-UserControl (code-wise)...
    The main-difference being, the "internal name of the Base-Functionality-Object, which offers all kind of Properties and Events":
    - at the inside of a VB.UserControl-CodeModule this Object is named: UserControl (the Events being UserControl_This and UserControl_That)
    - at the insde of a Widget-Class-Codemodule this Object is named: W (the Events being: W_This and W_That)

    BTW, a HitTest-Event is also available with normal VB-Usercontrols -
    but the Control has to be Windowless.

    Since Cairo-Widgets are always "Windowless", I had to introduce the W.ImplementsHitTest-Property to make a distinction for enabling this HitTest-Mode).

    HTH

    Olaf

  3. #3

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: Tile Cursor Interference (Cairo Overlays)

    Yep, cursor is a widget in the Invisible_Overlay (IO) widgetform. I thought I'd do it this way to save on re-rendering time.
    Ok, I'll re-try the Hittest thingy in a bit. Tried and failed this morning...

    P.S. Looking at your "Widget-Panel-DemoCode" I've seen that you renamed all the "internal W-Variables of a Widget-Class" to a "specific name".
    That's not a good idea IMO, because it's an internal Private Variable which should be the same "on the inside of any Widget-Class" (steering the behaviour of said Widget).
    Just like it says in the manual. Lol!
    I do this because I love my widgets, Olaf! Impersonal widgets are for serial killers and sociopaths. *Dramatic Music!*
    But I understand what you are saying. *More Dramatic Music!*

    Don't worry, our house was gifted with a Portable Grand Piano last night. And old one, but none of us can play it except bash the keys. Might be good for game music later though...

    Thanks for your help. I'll post back when I get it working.

  4. #4
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Tile Cursor Interference (Cairo Overlays)

    Quote Originally Posted by -Corso-> View Post
    Yep, cursor is a widget in the Invisible_Overlay (IO) widgetform.
    I thought I'd do it this way to save on re-rendering time.
    Hmm, ... a RenderLoop (which runs with about 40-60FPS), is constantly "re-rendering"...
    So, if you place your different PlayerCursor- and HoverCursor-States inside the RenderLoop-SubRoutines, e.g.:
    - "DrawGroundTiles", "DrawCursorPositionStates", "DrawTreesAndBoulders"
    ... then no extra-refreshs would be needed - you just flip a few global State-Variables and the rest is done in the RenderLoop.

    Quote Originally Posted by -Corso-> View Post
    Ok, I'll re-try the Hittest thingy in a bit. Tried and failed this morning...
    As I tried to explain in the prior post, the HitTest-mechanism will (probably) not help you in this case,
    because your MouseEvents still have to pass "TopLevel-Form/hWnd-boundaries"...

    Olaf

  5. #5

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: Tile Cursor Interference (Cairo Overlays)

    Olaf, I'm in the middle of rewriting the click-hover-tile-show mechanics for the mouse at the moment (removing first run spaghetti), but this looks like an identical issue to above.
    This picture https://www.dropbox.com/s/b0qegmpfzc...idget.jpg?dl=0

    I've setup a mini panel to appear which shows all items on the ground or table. To which the person can interact with, ie, click to place items in inventory (that's the plan).
    This mini panel is moveable, but the label when clicked on doesn't allow dragging. I tried a few things in the F2 list, but again, nothing worked. I'd like to keep the label there as it will say 'Too far' if you are not standing next to the items.
    Is there a cheap and easy way to make this part of the background of the frame, or is this the same as the hittest.
    And just to increase the difficulty, I'll be doing this a lot with labels on all the forms...

    Also for knowledge, the game doesn't render constantly. Only when one moves. So it's dead static most of the time. That will probably change with animation.
    Thanks again for help!
    Last edited by -Corso->; Dec 5th, 2022 at 03:17 AM.

  6. #6

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: Tile Cursor Interference (Cairo Overlays)

    Another Question.
    In the Planets demo, it sets up some buttons like this.
    Set PL = Form.Widgets.Add(New cwPlanets, "Planets", 100, 100, 200, 200)
    PL.Widget.ImageKey = "Planet Collection"
    PL.Widgets.Add(New cwImgBtn, "B_1", 40, 40, 48, 48).Widget.ImageKey = "B1"
    PL.Widgets.Add(New cwImgBtn, "B_2", 110, 40, 48, 48).Widget.ImageKey = "B2"
    PL.Widgets.Add(New cwImgBtn, "B_3", 70, 100, 48, 48).Widget.ImageKey = "B3"

    My Question. How do I change the individual Button Backgrounds (later, like during a repaint) to something else? Ie: How do I change just Button 2's background image to something different?

    It's straight forward with 1 item, but with several? I can't find the 'index' syntax for that.

    Thanks!

  7. #7
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Tile Cursor Interference (Cairo Overlays)

    Quote Originally Posted by -Corso-> View Post
    How do I change the individual Button Backgrounds (later, like during a repaint) to something else?
    Ie: How do I change just Button 2's background image to something different?

    It's straight forward with 1 item, but with several? I can't find the 'index' syntax for that.
    To access the Children of a given Widget-Container (in this case "PL"),
    you do it like with normal VB6-Controls-Collections (Container.Controls("CtlNameKey")):
    PL.Widgets("B_1").Widget.ImageKey = "SomeOtherResourceKey"

    But in case you want this to implement something like an "animated Button, blending between multiple State-Images"
    (to visualize each Button-States like e.g. "Hovered, Checked, Focused, Selected" via its own ImageResource),
    the whole thing is better hosted within the W_Paint-Event of the Widget itself -
    especially when you give that Widget an ImageResource, which contains "all the state-image-areas" combined).

    Below comes some DemoCode for a "MutiImage-Resource" like this:
    Name:  CheckStates.png
Views: 245
Size:  5.3 KB

    So, the resource above has 5 (vertically aligned) Sub-Images in it.
    - the first two for "unchecked-state=red" - and "checked-state=green"
    - the next two sub-entries represent the same states, with the addition of "being hovered"
    - the last sub-image-area (the 5th) is for rendering the "disabled state" of such a Button-Widget.

    Into a Widget-Class, named cwBtnMultiRes:
    Code:
    Option Explicit
    
    Public BlendInSteps As Long, BlendOutSteps As Long
     
    Private WithEvents W As cWidgetBase 'the usual internal W of type cWidgetBase
    Private WithEvents tmrBlend As cTimer, mBlendAlpha As Double '2 animation-related Vars
    Private mCaption As String, mChecked As Boolean 'the internal Vars for our two Public Props (Checked and Caption)
     
    Private Sub Class_Initialize()
      Set W = Cairo.WidgetBase
    
      BlendInSteps = 15
      BlendOutSteps = 30
    End Sub
    
    Public Property Get Widget() As cWidgetBase: Set Widget = W: End Property
    Public Property Get Widgets() As cWidgets: Set Widgets = W.Widgets: End Property
     
    Public Property Get Checked() As Boolean
      Checked = mChecked
    End Property
    Public Property Let Checked(ByVal NewValue As Boolean)
      If mChecked <> NewValue Then mChecked = NewValue Else Exit Property
      W.Refresh
    End Property
    
    Public Property Get Caption() As String
      Caption = mCaption
    End Property
    Public Property Let Caption(ByVal NewValue As String)
      If mCaption <> NewValue Then mCaption = NewValue Else Exit Property
      W.Refresh
    End Property
    
    Private Sub tmrBlend_Timer()
      Select Case tmrBlend.Tag
        Case "MouseEnter"
          If BlendInSteps Then mBlendAlpha = mBlendAlpha + 1 / BlendInSteps Else mBlendAlpha = 1.1
        Case "MouseLeave"
          If BlendOutSteps Then mBlendAlpha = mBlendAlpha - 1 / BlendOutSteps Else mBlendAlpha = -0.1
      End Select
      If mBlendAlpha < 0 Or mBlendAlpha > 1 Then Set tmrBlend = Nothing: Exit Sub
      W.Refresh
    End Sub
     
    Private Sub W_MouseEnter(ByVal MouseLeaveWidget As cWidgetBase)
      If mBlendAlpha < 0 Then mBlendAlpha = 0
      If W.Enabled Then Set tmrBlend = New_c.Timer(15, True, "MouseEnter")
    End Sub
    Private Sub W_MouseLeave(ByVal MouseEnterWidget As cWidgetBase)
      If mBlendAlpha > 1 Then mBlendAlpha = 1
      If W.Enabled Then Set tmrBlend = New_c.Timer(15, True, "MouseLeave")
    End Sub
    
    Private Sub W_Paint(CC As cCairoContext, ByVal xAbs As Single, ByVal yAbs As Single, ByVal dx_Aligned As Single, ByVal dy_Aligned As Single, UserObj As Object)
      Dim Pat As cCairoPattern, M As cCairoMatrix, State As Long
      Set Pat = Cairo.CreateSurfacePattern(Cairo.ImageList(W.ImageKey))
      
      Set M = Cairo.CreateIdentityMatrix
      
      If W.Enabled Then
        Set Pat.Matrix = M.TranslateCoords(0, W.Height * IIf(mChecked, 1, 0))
        CC.Paint W.Alpha, Pat
        
        If mBlendAlpha > 0 Then 'when timer-based blending is in progress...
           Set Pat.Matrix = M.TranslateCoords(0, W.Height * 2) '...this translate ensures an additional shift by 2 entries
           CC.Paint W.Alpha * mBlendAlpha, Pat
        End If
        
      Else 'render the disabled state (here in our resource, it sits at the 5th-position (at index 4)
        Set Pat.Matrix = M.TranslateCoords(0, W.Height * 4)
        CC.Paint W.Alpha, Pat
      End If
      
      If Len(mCaption) Then W.SelectFontSettingsInto CC Else Exit Sub
      CC.DrawText W.Height + 5, 0, W.Width - W.Height + 5, W.Height, mCaption, True, vbLeftJustify, 2, True
    End Sub
    Ok, here some Test-Code for a normal VB6-Form (Form1):
    (I gave it the Image-Resource like shown above, out of my c:\temp-folder - but feel free to load your own MultiRes-PNG)
    Code:
    Option Explicit
    
    Private WithEvents Panel As cWidgetForm
     
    Private Sub Form_Load()
      Cairo.ImageList.AddImage "MultiRes1", "C:\temp\CheckStates.png" 'add a "multi-state-resource"-png
      Cairo.ImageList.AddSurface "PanelBG", Cairo.CreateCheckerSrf(6, &H444444)
      
      Set Panel = Cairo.WidgetForms.CreateChild(hWnd)
          Panel.WidgetRoot.ImageKey = "PanelBG"
          Panel.WidgetRoot.ImageKeyRenderBehaviour = ImgKeyRenderRepeat
     
      Dim SingleResEntryHeight&
          SingleResEntryHeight = Cairo.ImageList("MultiRes1").Height \ 5 'Div 5, since we have 5 entries in it
      With Panel.Widgets.Add(New cwBtnMultiRes, "btnM1", 10, 10, 240, SingleResEntryHeight)
         .Widget.ForeColor = &HEEEEEE
         .Widget.ImageKey = "MultiRes1"
         .Checked = True 'set the current Check-State (here True=="Green")
         .Caption = "MultiResImg-CheckBox"
      End With
      
      Panel.Move 0, 0, 800, 600 'this Panel-move also ensures an implicit refresh
    End Sub
    
    Private Sub Panel_BubblingEvent(Sender As Object, EventName As String, P1 As Variant, P2 As Variant, P3 As Variant, P4 As Variant, P5 As Variant, P6 As Variant, P7 As Variant)
      If TypeOf Sender Is cwBtnMultiRes And EventName = "W_Click" Then
         Sender.Checked = Not Sender.Checked 'flip the checked state
         Me.Caption = Sender.Widget.Key & "->" & Sender.Checked 'report, which state we have (on which Button)
      End If
    End Sub
    HTH - please play around with that Widget-Class intensively, to get a better understanding "what's going on".

    Olaf

  8. #8

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: Tile Cursor Interference (Cairo Overlays)

    Don't worry Olaf, I'm constantly playing around with widget-classes, plus experiencing all the frustrations too. So much so it's becoming disenchanting. I have to learn via brute force method as there's no thorough training doco.

    I've hit another wall now, and not sure what is going on. I tried the PL.Widgets("B_1").Widget.ImageKey = "B2" thing and it was perfect. Thanks!

    BUT. Something isn't quite right in a similar situation. I'm not sure what's missing here...

    So far, the item panel (As per https://www.dropbox.com/s/b0qegmpfzc...idget.jpg?dl=0) is great in that it shows up whatever 1 to 4 objects are laying on the ground. You just right click on said tile and the mini panel loads in all the items pictures onto it's surface. Very nice.

    However, I wanted to change those flat -refresh- prints into buttons. So the user can click the item's picture and it takes it from the ground (& Mini Panel display) to the 'real characters' inventory. BUT!

    Loading those key images into the Item Panels -> Buttons isn't working. I can't find the cause.

    Error is :"Object Variable Or With Block Variable Not set"
    It occurs when you're on the screen and click a tile with an item(fruit or thing) on it. Ie: All the graphics are loaded, and classes are all made.

    Trimmed down Setup is:
    Class_Item_Panel_Small 'A neater Mini Item Panel that shows what's on the ground'
    Public My_Item_Buttons As Class_Item_Button
    Private Sub Class_Initialize()
    'All the usual bits are removed for reading'
    -Set My_Item_Buttons = W.Widgets.Add(New Class_Item_Button, "Item Button 1", 36, 19, 36, 36, True)
    -Set My_Item_Buttons = W.Widgets.Add(New Class_Item_Button, "Item Button 2", 36, 19 + 40, 36, 36, True)
    -Set My_Item_Buttons = W.Widgets.Add(New Class_Item_Button, "Item Button 3", 36, 19 + 80, 36, 36, True)
    -Set My_Item_Buttons = W.Widgets.Add(New Class_Item_Button, "Item Button 4", 36, 19 + 120, 36, 36, True)

    W_Paint(<-Trim version for show)

    'Bit of code to find the 1 to 4 ground items icons' numbers here. For A=1 to 4
    -My_Icon_Name = Cairo.ImageList.KeyByIndex(Icon_Number)'Get the icon name (Checked and perfect)
    -My_Button_Name = "Item Button" & Str(A)'Make the Object Name as there are four buttons (Checked and perfect)

    'Next line is where the error occurs
    -My_Item_Buttons.Widgets(My_Button_Name).Widget.ImageKey = My_Icon_Name
    -----------------------------------------------------------------------
    Class_Item_Button'And the button widget base.
    Private WithEvents W As cWidgetBase
    Private Sub Class_Initialize()
    Set W = Cairo.WidgetBase
    & And all the other bits and bobs 'exactly' like the Planets demo cwImgBtn


    I don't don't get why it won't hand an ImageKey over? Any ideas?
    Last edited by -Corso->; Dec 5th, 2022 at 06:02 PM.

  9. #9
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: Tile Cursor Interference (Cairo Overlays)

    It looks like you are missing a space when you build your My_Button_Name string.

    So you add objects to the Widgets class with keys like "Item Button 1", "Item Button 2", but when you build your My_Button_Name string you are getting "Item Button1", "Item Button2", etc...

    The error occurs because the Widgets collection can't find a button widget named "Item_ButtonX" (but it should be able to find one called "Item Button X").

    As a side note, this kind of oversight is one reason why I often like to substitute underscores for spaces for my Keys. e.g. "Item_Button_1" instead of "Item Button 1".

  10. #10

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: Tile Cursor Interference (Cairo Overlays)

    Quote Originally Posted by jpbro View Post
    It looks like you are missing a space when you build your My_Button_Name string.
    Nah, triple checked that. The construction of My_Button_Name = "Item Button" & Str(A) actually 'puts' a space between the string and the converted integer.
    Basically, "Word" & Str(54) = Word 54
    It's a thing of VB. Not that I like it, but that's what it does.
    I made sure and put the debug.print result next to the built name, to check it was all good there. There were no added characters or anything either. So it does match up.

    I even put the dedicated name into this
    My_Item_Buttons.Widgets(My_Button_Name).Widget.ImageKey = "Item Button 1"
    and it gives the same error at this point. Plus I also gave it a dedicated image at one stage. Ie: personally loaded and an easy name.

    To me, it kind of looks like the widget hasn't been formatted correctly or can't find the resource for itself... But I mirrored what was in the examples.

  11. #11
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Tile Cursor Interference (Cairo Overlays)

    IMO you have to organize your Image-Resources a bit more carefully -
    (within the Cairo.ImageList).

    And since that list will contain potentially thousands of different little images,
    you have to come up with proper "speaking string-prefixes and/or -suffixes" -
    and the usage of indexes like in your code here:
    My_Icon_Name = Cairo.ImageList.KeyByIndex(Icon_Number)
    ...should be avoided...

    I'd introduce a "Loot-Collection" (of type cCollection or cSortedDictionary which both support Key/Value-pairs),
    and the "Key" of a given "Loot-Entry" should have the appropriate "Tile-Address-Coords" (e.g. in string-format "T_x_y").
    A single Key/Value-pair (entry) into that loot-collection would for example be:
    "T_10_20" / "Banana,BlueBottle,BlueBottle,Melon"

    Now, if your Cairo.ImageList has stored the matching Icons under StringKeys, prefixed with:
    - "Loot_Banana"
    - "Loot_BlueBottle"
    - "Loot_Melon"
    ... the "build-button-loop" of your little Popup-Panel could be:
    Code:
    'within a Tile-Click-Event (this is kinda "pseudo-code" - have left out Dim-Lines for Variables)
    TileCoordKey = GetCurrentTileCoordStringKey()
    
    If LootCol.Exists(TileCoordKey) Then 'does loot exist at that tile-coord-string currently?
       For Each LootString In Split(LootCol(TileCoordKey), ",") 'split the comma-separated Loot-Value-String and loop over the parts
            With Container.Widgets.Add(New cwImgBtn, "btn_" & Container.Widgets.Count, ...)
               .Widget.ImageKey = "Loot_" & LootString
            End With   
       Next
    End If
    That's quite simple and easy code above - and in case of a "W_Click"-Event that comes in over the "Bubbling-Event-mechanism",
    you can then directly query, what a given Widgets "Sender.Widget.ImageKey" contains (to make the proper Inventory-entry).

    Also,... please try to develop and test new functionality isolated and outside your Main-Project.

    If you do that, you will not only enforce a much better design in your Main-App due to "back-integration-pressure"
    (because such a separation forces you, to ensure better encapsulation and better "genericity" of routines and classes) -
    it will also allow you, to "zip-up" your "shorter snippets" from such a Test-Project, posting them here, for others to take a look.

    As it currently is, the "back-and-forth" is not very efficient, because we have to "make guesses" for the most part...

    Olaf

  12. #12

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: Tile Cursor Interference (Cairo Overlays)

    Olaf, I was currently using the entire file directory and filename as the unique identifier. But changing that to a loot based one is easy. I'll just use the first parent directory & filename. (It's organized pretty well straight up).

    Yeah, I had your planet's demo working just right with the button issue. So I remade it bigger in the main project.
    Anyway, if there is no blindingly obvious answer to the above, I'll rip it out and build separately. It's weird how it works for everything else so perfectly but not a 'new button' on the mini panel.....

  13. #13

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: Tile Cursor Interference (Cairo Overlays)

    Found the freaking the answer!

    It's the end of the Button Setup 'My_Item_Buttons'. One needs to add this (below) specifically at the end. It doesn't prompt you or add in the autofill text options, so one reasonably assumes it isn't needed, or that it can be added in later.

    .Widget.ImageKey = ""

    Goddamit. Autofill let me down. It's 'absence' filling in THIS part has been fooling me all day!

    *Insert catatonic rage quit image*
    Last edited by -Corso->; Dec 6th, 2022 at 05:42 AM.

  14. #14
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: Tile Cursor Interference (Cairo Overlays)

    Quote Originally Posted by -Corso-> View Post
    Nah, triple checked that. The construction of My_Button_Name = "Item Button" & Str(A) actually 'puts' a space between the string and the converted integer.
    Basically, "Word" & Str(54) = Word 54
    Ahh right I'm a dope, I forgot that Str adds a leading space to positive values, I usually use CStr which doesn't.
    Last edited by jpbro; Dec 6th, 2022 at 08:27 AM.

  15. #15

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: [RESOLVED] Tile Cursor Interference (Cairo Overlays)


    https://www.dropbox.com/s/rj39comdpy...Items.jpg?dl=0
    And now we have hoverable/clickable items.
    It's a bit tacky for the click colours, as I'm just using vector lines. But hey, it'll do for the moment. I might end up doing lacework for the hover/click later.
    Anyway, time to build the Character Inventory.

    You know JPBro, I didn't know that CStr trimmed! I'll be using that from now on.

  16. #16
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: [RESOLVED] Tile Cursor Interference (Cairo Overlays)

    Quote Originally Posted by -Corso-> View Post
    https://www.dropbox.com/s/rj39comdpy...Items.jpg?dl=0
    And now we have hoverable/clickable items.
    Glad you solved it...

    Quote Originally Posted by -Corso-> View Post
    You know JPBro, I didn't know that CStr trimmed! I'll be using that from now on.
    Good choice.

    As for the yet unanswered question, how to make the "Title-Label of the Container-Widget" click-through...
    (so that the Container can be moved also when clicking on this container-area)...

    The easiest way to solve that, is to "not use a Label-Widget at all"...
    You have a W_Paint-Event inside your Container-Widget - and can render your Title-String by utilizing the CC:
    W.SelectFontSettingsInto CC 'select the containers current FontSettings, before doing "centered Title-rendering"
    CC.DrawText 0,0, W.Width, 30, "Your Title, or Title-Public-Prop of the Container", True, vbCenter

    HTH

    Olaf

  17. #17

    Thread Starter
    Hyperactive Member -Corso->'s Avatar
    Join Date
    Oct 2021
    Posts
    379

    Re: [RESOLVED] Tile Cursor Interference (Cairo Overlays)

    Thanks Olaf, that worked well!

Posting Permissions

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



Click Here to Expand Forum to Full Width