Is there a SEND_COMMAND to move or resize a button?
Is it possible to move or resize a G4 touch panel button dynamically? There is an abundance of properties we have access to at run-time with SEND_COMMANDs but I don?t see anything for left, top, height, and width. Maybe I?m not looking in the right place in software history?
TIA
TIA
0
Comments
I think this should position a general button 34, in both states to top/left 20/30, width 100 height 50
SEND_COMMAND dvPanel,'^BMF-,34,0,%R20,30,100,50'
I remember one of the developers sharing at a training session how it got the "BMF" name: "Big Mother-F'ing" command.
If you used dynamic images you wouldn't even need bitmaps on the panel file.
Wouldn't that confuse someone trying to steal your panel file!
Has anyone actually done that?
It'd be useful for creating games (for the programmer who doesn't think making a living is important).
'%R',<left>,<top>,<right>,<bottom>' Set Rectangle.
Following your example, to position button 34 to top/left 20/30, width 100 and height 50 it looks like the following needs to be sent:
SEND_COMMAND dvPanel, ?^BMF-34,0,%R30,20,130,70?
There are situations where it would be more straight forward if we had the option to set top, left, width, and height as individual properties (feature request?) but the %R embedded code gets the job done.
Thanks, Marc.
I just wanted to see if have read the manual :rolleyes: (typical excuse of a trainer
I was wondering though, if there was a way of retrieving the button position.
(so i can do a relative move)
OK, where the F is R !
I can't find it in either Software History or PI.
AMX-PI ----------------------------------------------------------------------------------- ------------------------------------------------------------------------------ BUTTON COMMANDS WITH EMBEDDED CODES: ----------------------------------- (Note: A device must first be defined in the NetLinx programming language with values for the Device: Port: System (in all programming examples - Keypad is used in place of these values)). "'^BMF-<variable text address range>,<button states range>,<data>'" Set any/all button parameters by sending embedded codes and data. See below for embedded codes. Syntax: SEND_COMMAND <DEV>,"'^BMF-<vt addr range>,<button states range>,<data>'" Variables: variable text address range = 1 - 4000. button states range = 1 - 256 for multi-state buttons (0 = All states, for General buttons 1 = Off state and 2 = On state) level range = 1 - 600 (level value is 1 - 65535) data = embedded codes below. Embedded Codes are: '%B',<border style> Set the Border Style name. '%B',<border 0-27,40,41> Set the Border Style number. '%DO<1-5><1-5><1-5><1-5><1-5>' Set the draw order. Listed bottom to top. '%F',<font 1-8,10,11,20-29,32-xx> Set Font (Font ID#'s generated in TPD4). '%F<font 01-08,10,11,20-29,32-xx>' Set Font (Font ID#'s generated in TPD4). '%MI<mask image>' Set the mask image (See ^BIM). '%T<text>' Set Text using ASCII characters (empty is clear). '%P<bitmap>' Set Picture/Bitmap filename (empty is clear). '%I',<icon 1-9900, 0-clear> Set Icon using values of 01 - 9900 (icon numbers are assigned in the TPDesign4 Resource Manager tab - Slots section). '%I<icon 01-9900, 0-clear>' Set Icon using values of 01 - 9900 (icon numbers are assigned in the TPDesign4 Resource Manager tab - Slots section). '%J',<alignment of text 1-9> Set text alignment using telephone Keypad layout (1 = left, top 5 = center, middle 9 = right, bottom). '%JT<alignment of text 0-9>' Set text alignment using telephone Keypad layout (1 = left, top 5 = center, middle 9 = right, bottom 0 is absolute followed by '<left>,<top>' outside the border. '%JB<alignment of bitmap/picture 0-9>' Set bitmap/picture alignment using telephone Keypad layout (1 = left, top 5 = center, middle 9 = right, bottom) 0 is absolute followed by '<left>,<top>' outside the border. '%JI<alignment of icon 0-9>' Set icon alignment using telephone Keypad layout (1 = left, top 5 = center, middle 9 = right, bottom) 0 is absolute followed by '<left>,<top>' outside the border. '%CF<on fill color>' Set Fill Color. '%CB<on border color>' Set Border Color. '%CT<on text color>' Set Text Color. '%SW<1 or 0>' Show/Hide button. '%ST<style>' Button Style. '%SO<sound>' Set Button Sound. '%EN<1 or 0>' Enable/Disable button. '%WW<1 or 0>' Word wrap on/off. '%GH<bargraph hi>' Bargraph upper limit. '%GL<bargraph low>' Bargraph lower limit. '%GN<bargraph slider name>' Bargraph slider name/Joystick cursor name. '%GC<bargraph slider color>' Bargraph slider color/Joystick cursor clr. '%GI<bargraph invert>' Bargraph invert (0,1,2,3-See ^GIV). '%GU<bargraph ramp up>' Bargraph ramp up time 1/10 sec. '%GD<bargraph ramp down>' Bargraph ramp down time 1/10 sec. '%GG<bargraph drag increment>' Bargraph drag increment relative bargraph (See ^GDI).. '%VI<1 or 0>' Set Video, Video ON = 1, OFF = 0. '%OT<feedback type>' Feedback Type: None, Channel, Invert, On(Always On), Momentary, Blink. '%SM' Submit text for text area button. '%SF<1 or 0>' Set focus for text area button. Note: Do not assign a variable text address range to set focus to multiple buttons. Only one variable text address can be in focus at a time. '%OP<0-255>' Button Opacity (0=Invisible,255=Opaque). '%OP#<00-FF>' Button Opacity (00=Invisible,FF=Opaque). '%UN<Unicode text' Set Unicode text (See ^UNI).. '%LN<0-240>' Set lines of video removed. '%EF<text effect name>' Set text effect. '%EC<text effect color>' Set text effect color. '%ML<max length>' Set max length of a text area. (This is only for text area input button & not for text area Input Mask button). '%MK<input mask>' Set input mask of a text area. '%VL<0-1>' Logon/logoff computer control. '%VN<network name>' Set the network connection name. '%VP<password>' Set the Network connection password. Example: SEND_COMMAND D:P:S,"'^BMF-500,1,%B10,%CF Red,%CB Blue,%CT Black,%Ptest.png'" Set button OFF state Border, Fill Color, Border Color, Text Color and Bitmap.The ^BMF is very useful for example to size frames around buttons. If the buttons are sometimes hidden and sometimes visible you can size the frame depending to the visible buttons. For screensavers and fast graphic effects i would like to have real hardware accelerated graphic-chips in the G4 panels ... ;-)
Nope, still don't see it.
Release Notes..: Software History 2 Application
Program Version: V2.1.0.25
Content Version: 5.9
Date...........: 05/26/06
Web Update doesn't list a newer version or a need to update.
Any idea on retrieving the position and size yet?
I can't even find the "R". I think I recall looking for this capability a while back and ran into a dead end. If I had found the "R" back when I may have been able to do what I was attempting to do, what ever that was.
The only thing I would suggest is to use the elusive "R" embedded command and initialize the buttons you want x/y coordinates for at start up and just track the last "R" data values sent.
It would be nice if this were simplified with a query command and then change the postion in the same simple manner that you change hide and show effects x/y positon. It does seem a little odd that effect positon change is directly supported but the actual button postion isn't.
It works pretty well as I used it to build a simple web browser on Modero Touch panels, but some first generation Moderos are not very efficient to draw on fly buttons
Don't forget everything you do with BMF commands is not stored in panels so each time you cycle power everything is lost !
Vinc