Announcement

Collapse
No announcement yet.

3 questions about Win buttons

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 3 questions about Win buttons

    Alright, I have three questions about Win buttons and what they can do. I am working on a project for automating a collimator and wanted to explore some advance features for Win buttons (other buttons could work as well, but currently I am using Win buttons.) I also have Workshop Pro.

    Question #1: I have a tilt sensor attached to my board and was wondering if its possible to flip the win button captions ( I have 17 as the caption on one of my win buttons). So when the touch screen is in landscape the number 17 would be in parallel with the bottom of the screen, however if the tilt sensor determined that the collimator was tilted 90 degrees ( The screen is in portrait - with the landscape right side as the new bottom) could I rotate the number 17 so it is in parallel with the portrait bottom (landscape right side)?

    Click image for larger version

Name:	4D systems landscape to portrait crude example.jpg
Views:	1
Size:	16.6 KB
ID:	46132


    Question #2: Is it possible to change the current caption of a Win button without going through 4D workshop. So by default my win button would have the caption 17, however if the user wanted to change this number could he do it through the touch screen? So lets say the user clicks on a button called options, this brings up another menu with a keyboard in the center. The user clicks on the win button with the caption 17, then uses the keyboard to type in 13. Is it possible to change the number 17 to 13 using the new Pro Magic options?

    Click image for larger version

Name:	Win button example.png
Views:	1
Size:	4.9 KB
ID:	46133


    Question #3: Is it possible to have a different effect if a user presses a win button vrs holding down the win button. In my project I want to have a memory button that when pressed it opens two pairs of shutters to X and Y. Then if the user decided that X and Y were incorrect, the user could manually move the shutters to Z and W then press and hold the win button and a sound would activate and the button would store the current position as Z and W. Then next time the user pressed the button the shutters would move to Z and W. The coding for the memory I can do (changing X and Y to Z and W), however is it possible to press and hold the button?

    Thanks in advance for your guys help!!
    Chad T

    P.S. I know the sketches are crude, but I'm not very good at paint haha!
    Attached Files

  • #2
    The text could be rotated by using blocked buttons, although they would have to be user buttons with externally made graphics. Wouldn't it be best to change the orientation of the entire screen? I imagine that could be done using Genie Magic.

    You can't change the caption of a button at run time. The best thing is to put the text as a string beside the button. You could use Genie Magic to draw the text over the button, although that will probably end up happening with a bit of a flicker, depending on how it is done.

    The only way to completely change the action of a button is to have a separate form with a different action defined and change the form when you want a different action.

    Of course if you were to write this program in ViSi, rather than Genie all of the above could be achieved reasonably easily.
    Mark

    Comment


    • #3
      Thanks for the reply! Sorry for the delayed response, but I wanted to try out Visi in case I had some questions, which ends up I do. Not sure if this is the best place to post this question since technically we are still in the Visi-Genie forums, but since we are talking about it, I will post it here. Feel free to move the post to wherever.

      Is it possible to interface Arduino with Visi? I have worked with some of the Visi code and it seems nice (a lot harder that visi genie haha, but that is to be expected), however I have not been able to find any examples of working with both Visi and Arduino. If I go to the 4D Workshop download I see library support for arduino in both the Serial and Visi-Genie areas, but not for Visi or Designer. Also is there any examples of using Arduino with a Visi program? Does it use the same Genie handler that queues up the button presses and allows the Arduino environment to read, react, and write to the touch screen? Thanks in advance for your help, and I am really hoping it is as simple as when I was able to use Visi-Genie with Arduino.

      Just to clarify, my project that I am working on is using the ATMEGA 2560 chip and unfortunately is already attached to our designer board, so for the project I have to have a base level arduino code that handles all the motors, encoders, SPI lines, and serial communication that also communicates with the 4D systems touch screen that (hopefully) is running Visi code. The touch screen is attached to the ATMEGA chip using RX and TX lines, as well as restart, GND, and VIN. I need to be able to read Winbutton presses and to be able to write data to various strings. I can go into more detail if necessary.

      Thanks,
      Chad T

      Comment


      • #4
        Well you can certainly do that, it's just you will need to write the serial comms on your Arduino and the display.

        Serial and Genie have libraries for Arduino because the protocol is 'defined'. When you go to ViSi or Designer there is no defined protocol, so you will need to define both ends yourself.
        Mark

        Comment


        • #5
          Mark, thanks for the quick reply.

          I know this sounds super ignorant, but I chose to work with arduino and Visi-Genie to stay away from having to define protocols and get into high end coding, I am a newer programmer and do not have much practice with protocols, however for some of the functions we want to use with the touch screen, programming in Visi sounds like the way we want to go (its that or drop the extra functions we would like to have). By chance do you have any examples of a Visi program working with an Arduino program? More specifically an example that has multiple buttons on the touch screen and when one is pressed arduino would read the button press and determine which button was pressed and send out a message to a string on the touch screen that tells the user which button they pressed?

          I know this can be done without interfacing to arduino but for the sake of my project and because I was using visi-genie before, I have arduino set up to do the following. Once a button on the touch screen is pressed, arduino takes the data from the genie and determines which button was pressed, moves some motors around, then outputs data to various strings located on the touch screen. This is pretty simple when using visi-genie as the library handles all the communication, but I am running into a wall trying to figure out how it can be done through Visi.

          I appreciate the time and effort you have spent in answering my questions, and if you think I would have better luck just sticking with visi-genie please let me know!

          Thanks,
          Chad T

          Comment


          • #6
            Based on what you have said, why not continue using Genie?

            What is it that Genie can't do? Why not use Genie Magic for that bit?
            Mark

            Comment


            • #7
              Thanks for the advice, I started the 7 day trial for Genie Pro so I will give that a try, if I cant seem to get things working I will ask more questions. Hopefully I can just figure this out using Genie Pro and wont have to worry about all the protocol stuff.

              Comment


              • #8
                "You can't change the caption of a button at run time."

                Yes, however, like I do with gauges and other objects, you can overlap a second button, same size, different text, right over the other button, the host can send the button to the front while disabling the old button via 0xFFFF method. For buttons you must follow the disable method, but for gauges or anything non touch, you can bring them in front just by writing a value to them without disabling. I've created 3 separate color bars for example the battery, low (red) medium (yellow) and good (green), at a certain threshold, the host will write to the proper color bringing it to the front.

                So OP, if you want the button to have a different name and function, click your button, CTRL+C to copy, CTRL+V to paste, make sure it has the same TOP and LEFT values as the other one, change the text in it, have them set to report message, then goto Project tab, and make sure you have "Allow buttons to be disabled". Then flash your lcd. in your host, just write 0xFFFF to the button you dont wanna see and it'll disappear, "Buttons can be re-enabled by writing a normal, non 0xFFFF value to them.
                Last edited by tonton81; 5th May 2016, 11:06 AM.

                Comment


                • #9
                  I saw that you said "Of course if you were to write this program in ViSi, rather than Genie all of the above could be achieved reasonably easily." How do you do that? I want to change the caption of labels and buttons programmatically in ViSi, but I can't figure out how to do that. I don't see any mention of it in the "Context Sensitive Help" and I also didn't see it mentioned in the example about strings and text.

                  Comment


                  • #10
                    In ViSi you can change the screen orientation using one command, you can reposition the buttons and redisplay them when the orientation is changed
                    Mark

                    Comment


                    • #11
                      Hi Mark, thanks for the reply, but I wasn't talking about screen orientation. I said "I want to change the caption of labels and buttons programmatically in ViSi, but I can't figure out how to do that." Should I just start a new thread?

                      Comment


                      • #12
                        No you can't change them programaticaly.

                        Depending on how many 'different' labels/buttons you want, you either create them all at design time and then use the appropriate one at run time, or print something on a blank button immediately after drawing it.
                        Mark

                        Comment

                        Working...
                        X