Is there a SEND_COMMAND to move or resize a button?
Joe Hebert
Junior Member
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
Comments
-
The '^BMF' command should help. With its embedded codes, you can do almost anything (but just not creating a button from scratch, because you need a Address Code
)
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' -
The BMF command is exteremly powerful; it has a lot of options.
I remember one of the developers sharing at a training session how it got the "BMF" name: "Big Mother-F'ing" command. -
It would be possible to put 255 buttons on a page (or more if using multiple G3 devices or a G4 panel) and construct the entire GUI from code by turning buttons on and off, positioning, sizing, colouring, adding text, fonts and bitmaps dynamically.
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). -
According to Software History, the ^BMF command takes x/y coordinates for left/top and right/bottom:Marc Scheibein wrote: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'
'%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.
-
Joe Hebert wrote:According to Software History, the ^BMF command takes x/y coordinates for left/top and right/bottom:
'%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
) -
Ive done this to make a screensaver, it works well.
I was wondering though, if there was a way of retrieving the button position.
(so i can do a relative move) -
You can use a CUSTOM_EVENT to get an answer from a button query but it doesn't look like button position is supported.Yarm wrote:I was wondering though, if there was a way of retrieving the button position.AMX-PI wrote:BUTTON QUERY COMMANDS:
Button Query commands reply back with a custom event.
There will be one custom event for each button/state combination.
Each query is assigned a unique custom event type.
The following example is for debug purposes only:
NetLinx Example: CUSTOM_EVENT[device, Address, type]
DEFINE_EVENT
CUSTOM_EVENT[TP,529,1001] // Text
CUSTOM_EVENT[TP,529,1002] // Bitmap
CUSTOM_EVENT[TP,529,1003] // Icon
CUSTOM_EVENT[TP,529,1004] // Text Justification
CUSTOM_EVENT[TP,529,1005] // Bitmap Justification
CUSTOM_EVENT[TP,529,1006] // Icon Justification
CUSTOM_EVENT[TP,529,1007] // Font
CUSTOM_EVENT[TP,529,1008] // Text Effect Name
CUSTOM_EVENT[TP,529,1009] // Text Effect Color
CUSTOM_EVENT[TP,529,1010] // Word Wrap
CUSTOM_EVENT[TP,529,1011] // ON state Border Color
CUSTOM_EVENT[TP,529,1012] // ON state Fill Color
CUSTOM_EVENT[TP,529,1013] // ON state Text Color
CUSTOM_EVENT[TP,529,1014] // Border Name
CUSTOM_EVENT[TP,529,1015] // Opacity
{
Send_String 0,"'ButtonGet Id=',ITOA(CUSTOM.ID),' Type=',ITOA(CUSTOM.TYPE)"
Send_String 0,"'Flag =',ITOA(CUSTOM.FLAG)"
Send_String 0,"'VALUE1 =',ITOA(CUSTOM.VALUE1)"
Send_String 0,"'VALUE2 =',ITOA(CUSTOM.VALUE2)"
Send_String 0,"'VALUE3 =',ITOA(CUSTOM.VALUE3)"
Send_String 0,"'TEXT =',CUSTOM.TEXT"
Send_String 0,"'TEXT LENGTH =',ITOA(LENGTH_STRING(CUSTOM.TEXT))"
}
All custom events have the following 6 fields:
Field Description
Uint Flag 0 means text is a standard string, 1 means Unicode encoded string
slong value1 button state number
slong value2 actual length of string (this is not encoded size)
slong value3 index of first character (usually 1 or same as optional index
string text the text from the button
text length button text length -
Originally Posted by Joe Hebert
According to Software History, the ^BMF command takes x/y coordinates for left/top and right/bottom:
'%R',<left>,<top>,<right>,<bottom>' Set Rectangle.
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. -
Strange, I don't see it in AMX-PI either but it is in Software History (version 2.1) if you look at an MVP-8400. %R is the first embedded code listed.vining wrote:OK, where the F is R !
I can't find it in either Software History or PI. -
Here is a small example for using the ^BMF.
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 ... ;-) -
Joe Hebert wrote:
Strange, I don't see it in AMX-PI either but it is in Software History (version 2.1) if you look at an MVP-8400. %R is the first embedded code listed.
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. -
I found %R a year ago, but in recent versions of software history is seems to have disapeared!
Any idea on retrieving the position and size yet? -
That's bizarre. It's obviously still supported in firmware unless SendString is using this on older panels but there shouldn't be any reason not to support it on new panels so maybe its omission in the new Software History & PI is just a mistake.Yarm wrote:
I found %R a year ago, but in recent versions of software history is seems to have disapeared!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. -
^BMF command has been removed few months ago of all documentations as it's not an official command officially supported, it should have never been released and no warranty is made it'll be still avalaible in future firmware

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
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums
