Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Text wrapping in sketchpad textline -- screen edge workaround not working

Hi all,

To achieve text wrapping in sketchpad textline, I set the resolution smaller than the monitor and hoped it would wrap when it reached the edge. This workaround to the lack of text wrapping for the textline object was suggested in this thread:

http://forum.cogsci.nl/index.php?p=/discussion/comment/11202/#Comment_11202

However, I'm not getting the text wrapping at the edge of the screen.

Details about my setup and experiment:
I have the resolution set to 1024 x 768 in OpenSesame, and I'm using the xpyriment back-end (also tried psycho with similar results). My monitor is 1920 x 1080, and I'm using a Windows 7 PC. I'm displaying survey items in a text box on a sketchpad. The sketchpad is in a sequence in a loop, and the survey items are listed in a column in the loop. When the items display, they run past the edge of the resolution defined in OpenSesame and in a few cases (long items), they run past the edge of the actual monitor and some of the words aren't displayed.

Also, I posted about this in the thread above, but it's marked solved, and I didn't get a reply, so I thought I'd better post a new comment. My apologies if that was the wrong approach :)

Thanks for any advice you have!

Tom

Comments

  • Hi Tom,

    Well, you caught the first bug to be fixed for 3.1.8! :wink: 3.1.7 is being prepared for release as I write this.

    Essentially, line wrapping hasn't been updated to support uniform coordinates, i.e. the option where 0, 0 refers to the display center in all cases. You can disable uniform coordinates in the General Properties tab. If you do that, you'll find that text wraps correctly again. But you also end up with the nonsensical behavior where 0, 0 refers to the display in sketchpad items but to the top-left in canvas objects. So pick your lesser evil!

    Cheers,
    Sebastiaan

  • What an honor to catch the first bug! I'll put that on my CV ;) I split the long items between two columns and it seems to be working, so I'll stick with that method for now. btw, your recent Psych Science paper on pupillary responses to brightness/darkness words was REALLY fascinating!

  • edited July 12

    Hi @sebastiaan and @TomArmstrong ,

    I am currently having issues with text wrapping, as I am using a variable to read sentences that are sometimes a bit long and thus are not getting wrapped. I can't manually set the resolution because this will be an online experiment. Can you suggest any fixes for easy text wrapping?


    Best wishes,

    Elinor

  • Hi @elinora18 ,

    Proper text wrapping is not available for OSWeb, but you can use a simple inline_javascript (courtesy of SigmundAI) to limit the text to a specific number of characters, and insert line breaks in between (using HTML <br> elements) like so. This should be in the prepare phase of an inline_javascript before myText is shown on a sketchpad :

    text = "I am currently having issues with text wrapping, as I am using a variable to read sentences that are sometimes a bit long and thus are not getting wrapped. I can't manually set the resolution because this will be an online experiment. Can you suggest any fixes for easy text wrapping?";
    maxLength = 50;  // Maximum number of characters per line
    myText = '';
    currentLength = 0;
    
    
    // Split the text into words
    words = text.split(' ');
    
    
    for (let i = 0; i < words.length; i++) {
      // Add the word to the current line
      currentLength += words[i].length + 1;  // +1 for the space
      if (currentLength > maxLength) {
        myText += '<br>';
        currentLength = words[i].length + 1;  // Reset length counter
      }
      myText += words[i] + ' ';
    }
    
    
    // To remove the last trailing space
    myText = myText.trim();
    

    You can also implement more

    — Sebastiaan

  • Hi @elinora18,

    Please see my reply to your post about this a few days ago.

    https://forum.cogsci.nl/discussion/9427/text-wrapping#latest

    Best,

    Fabrice.

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games