Now just for kicks, let's add text to the picture panel. Or you can use a textbox or spinner control to resize a panel: To resize the panels, you just give the panel the number of pixels wide you want it to be: This chunk of code adds the panels and sets their type: All you have to do is set the 'Style' property to a value greater than 0 (plain text):ġ = Caps, 2 = Num, 3 = Ins, 4 = Scrl, 5 = Time, 6 = Date The control takes care of the work for you. Then elsewhere in code, set them as the picture: Where the files are name bar0.bmp - bar12.bmp STORE LOADPICTURE('Graphics\' + Substr(cNewVar, 2) + '.bmp') TO (cNewVar) STORE 'oBar' + Alltrim(Str(zzz)) TO cNewVar In the form's Init method, you first create a handle to each of the picture objects: I made them about 15 pixels high by about 150 wide. Since I can't post them here for you to use, make your own or use the link to download mine. All you do is set the picture to each one of these, and it looks like a real progress bar. (1).Picture = oGreenLightįor a progress bar, I made 13 little bitmaps with progressively longer coloring. You can use that handle to display the picture on the statusbar using: STORE LOADPICTURE(Home() + 'Graphics\TRFFC10A.ICO') TO oGreenLight Of course you can once again, use the index number: (3)Īfter you have created the handle to the picture object using: In this example I use the 'count' property to remove the last in line: To remove a panel, either specify which panel to remove by idnex number. mystatusbar1.Panels(.spPanelNumber.Value).Text = Īlltrim(str(RECNO())) + ' of ' + Alltrim(str(reccount())) spPanelNumber.Value for a specific panel number if you wish. This code will set the text of the specified panel: If you want to insert a panel at a position in between two others, say add panel #3, you can just specify that position as in: (3) This adds a panel to the end of the current panels, and sets its resize property to 200: = Thisform.Widthġ- I added a status bar control, I need more panels.ĥ- How about a progress bar? (Are you serious?)Ħ- I need CAPS lock, NUM lock, Date and Time. To cure that, in the form's Init event, add the following line: So if the form runs as maximized, the control could be floating somewhere in the middle of the form. One thing to note on adding the statusbar control, as foxwizard pointed out, is that if the form's windowstate is set to 2, the control will remain at wherever the bottom of the form was at design time. The text box changes the text of the selected panel. The first spinner selects which panel to work with and the second adjusts the size of the selected panel. The radio control selects the auto-sizing of the panels (play with that a little, you'll see how it works). You will see several buttons, a radio control, a couple spinners, and a text box with the status bar at the bottom. From the IDE, run either the form or the program code. I saved the path names so it will unzip to a folder named C:\vfp_source\statusbar and the graphics will unzip to C:\vfp_source\statusbar\graphics. Scroll down until you get to 'StatusBar Active-x Demo' and download 'StatusBarDemo.zip' That's what this FAQ is about.įor a complete demo form with all the graphics and user interface, go here: That's all well and good, but other than keyboard status, folks usually want different messages displayed, or other GUI things. You can add text, key status (CTRL, CAPS, etc.). Click on Panels and make your panels look how you like. So if you just want to use a status bar on your form, drop one on there, right click and select 'SBarCtrl Properties'. I wanted to use one in an app I'm developing and also, there have been several questions posted in this forum on status bars. There is a status bar Active-x control, but it isn't the most user friendly, nor is the documentation all that swell. You want more from a status bar than what comes natively with VFP.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |