How do I make a dynamic text window?

0 favourites
  • 8 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • I am trying to make a simple feature. The idea is you click a button and then you click and drag the mouse to create a box to type in, just like in any image editing software. I have currently made this: https://drive.google.com/file/d/0Bxfvxf ... sp=sharing (didn't know how else to put the image)

    Once I run the code everything looks fine. I click the button the sprite follows the mouse but after I click and drag the box doesn't appear (and yes I have forgotten to set it to visible but I did that while writting this and it still didn't work). So how do I do it?

  • It is Mouse.X - posX and Mouse.Y - posY. TextBox cant have a negative size.

    But i dont see a simple way to reset the Boolean in that flow.

    'On Button CLICKED' will steal a 'On Mouse button released'.

  • It is Mouse.X - posX and Mouse.Y - posY. TextBox cant have a negative size.

    But i dont see a simple way to reset the Boolean in that flow.

    'On Button CLICKED' will steal a 'On Mouse button released'.

    So I should use a On Button Pressed on both? I tried that and it still didn't work but I will try it again to be 100% certain.

  • It is Mouse.X - posX and Mouse.Y - posY. TextBox cant have a negative size.

    But i dont see a simple way to reset the Boolean in that flow.

    'On Button CLICKED' will steal a 'On Mouse button released'.

    Ok so I re-wrote part of the code because I forgot to save <img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes"> and it now looks like this :

    https://drive.google.com/file/d/0Bxfvxf ... sp=sharing

    When I run the code and click the button the cursor changes correctly. After that I click and drag but from what I understand an infinite loop takes place and everything just lags and firefox crashes. If I moved the actions from the While statement to the disabled (to the Is Checked sub-event) then the textbox appears where I want it to and scales depending on the mouses position just like intended but even if I let go of the mouse button it still scales with it and never lets go.

  • Based on the first selfie, this is what you try, or very close to.

    https://www.dropbox.com/s/a28b1xucic0op ... .capx?dl=0

    The second selfie makes no sense to me.

    About the While loop. The events run in a loop already. Use any other loop only if you want an iteration to happen inside 1 tick. If you update graphics in a loop, and therefor inside the time of 1 tick, you will never see them updating, besides there where the loop ended, because the drawing happens at the end of every tick. Hence the term 'Frame Depended'.

    About the 'and never lets go'. The text-box that you draw is 'in focus'. Meaning, it is stealing the mouse. A text-box is a form element. It does not live inside the canvas. It lives on top of the canvas in its own world. Basically canvas and form elements are different windows. If you have two windows on your desktop, the one that is in focus is getting keyboard and mouse changes. The other dont.

    Just disable the object, so it can not switch to 'in focus'.

  • Based on the first selfie, this is what you try, or very close to.

    https://www.dropbox.com/s/a28b1xucic0op ... .capx?dl=0

    The second selfie makes no sense to me.

    About the While loop. The events run in a loop already. Use any other loop only if you want an iteration to happen inside 1 tick. If you update graphics in a loop, and therefor inside the time of 1 tick, you will never see them updating, besides there where the loop ended, because the drawing happens at the end of every tick. Hence the term 'Frame Depended'.

    About the 'and never lets go'. The text-box that you draw is 'in focus'. Meaning, it is stealing the mouse. A text-box is a form element. It does not live inside the canvas. It lives on top of the canvas in its own world. Basically canvas and form elements are different windows. If you have two windows on your desktop, the one that is in focus is getting keyboard and mouse changes. The other dont.

    Just disable the object, so it can not switch to 'in focus'.

    Ok so after a bit of time of rework after rework I made this which...half works. It works perfectly sometimes other times the textbox doesn't leave focus so if a mistake of some sort could be pinpointed that would be appreciated.

    Img: https://drive.google.com/file/d/0Bxfvxf ... sp=sharing

    I personally think its the "On button released" part but I don't know of a way around it.

  • Just disable the object, so it can not switch to 'in focus'.

    As i told you.

    Set the property 'enabled' (in the layout) to 'no'.

    After the full creation sequence (including scaling), use the action .. TextBox > Set enabled.

    If you going to draw boxes on top on each other, then use my example.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • >

    > Just disable the object, so it can not switch to 'in focus'.

    >

    As i told you.

    Set the property 'enabled' (in the layout) to 'no'.

    After the full creation sequence (including scaling), use the action .. TextBox > Set enabled.

    If you going to draw boxes on top on each other, then use my example.

    So I replaced the "Set unfocused" with "Set enabled" -> "Disable" and it still has that effect where some times it works and others it doesn't. I tried it with both and still same result. It seems to me that the "On Button Released" part sometimes doesn't get activated when I release as not only does it not get disbled but neither unfocused. Problem is I have no idea why. As for your code I don't know if it works on the 245 stable release since I had to download another release to open it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)