I'm relatively new to programming and my problem is with a TMainMenu on my form.
I researched a lot (a whole lot) of sites for a solution, but haven't found any that solves this exact problem.
The main menu won't resize, not even when I change the fontsize using Screen.MenuFont.Size. I tried setting the Height property in the OnMeasureItem handler, I tried resizing the images and sub-menuitems at both design- and runtime, I even tried capturing Windows' message WMDrawItem and changing it's parameter before passing it on...
The menu items in the component are resized accordingly, but the vertical height of the menubar itself isn't. (the line seen on the picture below cutting through the icons)
Is there an easy solution to this, like setting some well hidden height property somewhere?
Or do I have to rewrite half of delphi's code to achieve my goal?
Help with code examples are appreciated. :-)
Here's an image:
I am using Delphi 7 on a Win7 machine.
The height of the menu bar is a Windows metric setting. Thus it is valid system wide - not only for your application. If at all, it can only be changed via the display settings of Windows itself.
I would recommend to use TActionMainMenuBar instead. It is much more flexible then the TMainMenu.
You can change the font of the menu bar very easy as well.
Related
I have a Label and a Progess Indicator in my Vaadin indicator. It is dynamically made visible in the UI. There is a Tree below this Progress Indicator.
When the program dynamically sets the visibility of the Progress Indicator to true, the tree shifts down and the UI shakes due to the shifting.
Is there any way to make a Vaadin component occupy it's space, even if it is invisible and hence, when made visible it must not try to borrow space from other UI components?
What I am looking for is a feature similar to setRendered(true) in flex and actionscript programming.
Thanks for your help.
Finally I got an answer to my question. I just replaced the invisible components with a dummy visible label with no text.
And used it alternatively to switch between visible and invisible.
I asked the question in the Vaadin forum, and here's the response I got, from Kim Leppanen:
With Vaadin 7, if you set a component's visibility to false, then the component's information is not sent to the browser at all - it is just as if the component wouldn't exist in the layout at all.
I can quickly come up with two solutions. If you know the size of the component whose visibility you want to toggle, then you can use placeholder components - such as a Label. Put a label with the correct size in the place where you want the component. When you want to set a component as visible, then replace the label with the actual component.
The second option is to use css. Apply the css attribute "visibility: hidden" for the component you want to hide. Note that the component is not "truly" hidden. Let's say that it is a button. A user could still inspect the DOM tree and see the button in the code, change the visibility of the component on the client side (eg using developer tools or firebug) and then see and use the button as if it would be visible in the layout.
I am putting it here because people might add some more useful answers there. For a detailed explanation please see this.
Use this following example to the component you want set invisible but keeping its occupied space:
Image home = new Image();
home.setSource(HOME);
home.addStyleName("visibility: hidden");
OR
home.addStyleName("visibility: collapse");
I want to display PDF within iOS application, so far the only way I find is open it in TwebBrowser.
A.It is displaying in "fit to page width" zoom as default
B.There is no "zoom" function
WebBrowser1.Navigate(file://mypdf.pdf')
How to
I want to change the zoom after open the file (My solution encounter q#2)
Make the zoom work (My solution encounter q#3)
Make the gesture as work just like web page
For #1:
I chagne WebBrowser1.height/width in run-time, it will auto scale(zoom?) as "Fit to width".
Yes it works, and vertical scroll bar works with a flaw - it will not bounce back on edge -> you can scroll all the way down..
Neither the horizontal scroll, not reacting at all....
*This is because the pdf is A4, not sure what will happen for a landscape style
For #2:
Beside using button clicks to zoom, I add a gestureManager.
Then add Form1.ongesture just like the "iOS Interactive Gestures - Image Zoom" example.
Yes it works, but same thing - no vertical bounce, no horizontal scroll.
*ScrollBox does not work, it will not work with any thing has a build-in vert/hori scroll bars
For #3
:
I go even further, write control for up/down/left/right
Change WebBrowser1.Position.X/Y and WebBrowser1.height/width to make it looks like "scrolling"
Yes it works... but two custom gesture controls are making it really hard to control
(EventInfo.Distance and EventInfo.X/Y, those 2 controls are kinda overlaping to eachother if you run in iPhone)
The wosrt part is, the WebBrowser1 will be on top of ANY compenment, regardless parent/child structure .
The second worst part is the limitation of margin is hard to code, somehow it can always scroll over the limit.....
I "feel" if changing the zoom on/after open, and make it open with both vert/hori scrool bars visible.
Then the horizontal bar should work -> i only need to deal with zoom -> pretty close to prefect.
Of course the best way is to make it work like a web page, like
WebBrowser1.Navigate('http://www.embarcadero.com/') -> both scrollbars works, zoom work.
but...maybe need service pack N for this?
I appreciate for any ideas or code answers.
This damned monkey is on fire and its always hard to find an answer from it.
An article was posted today on The Hacker's Corner called Getting TWebBrowser on iOS to zoom. It suggests a one-line fix to the FMX.WebBrowser.iOS.pas unit. Does this help?
It was a bug, and fixed in the XE4 update.
I was wondering, if it is somehow possible to add a TextBox in the Application Bar area (the same way the Internet Explorer does), but I didn't find any information source about this. Have you any idea, how to accomplish this task?
You will not be able to add UIElements inside ApplicationBar as it is not derived from UIElement.
Alternatively, you can try adding a Grid at the bottom of the screen and color it similar to the ApplicationBar. Then add a TextBlock inside the Grid. This is just a workaround and not recommended as it is not according to the standards.
You can also check the following link:
http://www.maxpaulousky.com/blog/archive/2011/01/10/bindable-application-bar-extensions-for-windows-phone-7.aspx
I know it's a fat chance I'll find an answer here, but since devexpress support is a little slow I thought I'd give it a try.
Basically I'm using DevExpress 2011.1.2 beta, it's been working wonders, I love it. But I had a small issue with it recently...
I inserted an expressbar on the Delphi form and used the images from cxImageList, however, I noticed that the icons on the bar buttons were showing black and white, but when I had my mouse over, it displayed the true colors. I did not modify anything, and yes, the button is enabled.
Here's an image to better illustrate my problem:
I know the solution must be simple, however I couldn't find anything related.
Thank you.
EDIT: After modifying the button's property AutoGreyScale to false the color returned, but dull and lifeless, and when mouse is over it, more colorful.
ImageOptions of my Bar:
Set the button's AutoGrayScale property to False. You may also want to change the value of the global dxBarMakeInactiveImagesDingy variable. The TdxBarManager.Style property may also have an effect.
Also, make sure you haven't set HotImages while leaving Images unassigned.
We have developed a software. In this software we are show and hiding a few controls on various input screens depending on various situations.
When we hid a control what happens is that the space occupied by that control is left as it is and layout looks very bad at times esp. in screens that have larger numbers of controls. Our client does not like this and has asked us to do something about this.
My question:
Is there some way by which we can create Fluid Layouts so that when a control is hidden the rest of the controls automatically adjusts themselves to fill the empty space left by the control hidden and when the control is show they should automatically make way for the control and adjust themselves accordingly.
I know we can achieve this by coding but that will require a lot of code in each screen for adjusting the layout. I am looking something which will reduce coding in each screen as there are 80+ screens.
Please suggest some way which is less error pron and can get rid of unnecessary coding in each input screen.
I think your best option is to use a component that handles the layout of your vcl controls on your form in runtime (depending on the conditions that you define). I recommend you try the Devexpress ExpressLayout Control
you can find two great demo videos here
ExpressLayout Control - How to Customize Layout Views
ExpressLayout Control - Create and Customize a Simple Layout
(source: devexpress.com)
You can check these features
Auto-Management - Control groups and individual control elements are automatically managed by the Layout Control. You never worry about pixel-by-pixel positioning.
Form auto-sizing - The form can be automatically resized to fit its contents best.
Bye.
Now, I'm not sure how complex layout you have, but I guess you can use TFlowPanel and/or TGridPanel for this. Flowpanel has a nice handling of components that change visiblity. I'm not sure how well gridpanel handles the same...
What kind of controls are you dynamically hiding, and what do you mean with auto fill space?
I do not know if it is as this simple: place controls on panels, and use align alTop/alClient/alBottom. When you hide a panel, all other panels will move automatically up.
One problem though: if you want to show a panel again, the order of panels can sometimes be screwed up... Can be fixed by manually setting .Top property, or "hide" by setting .Height := 1;
What I would do with a complex layout is actually split it up into several tabs. This has two advantages. It simplifies the form layout, and allows you to show and hide whole tabs depending on choices made in other tabs.
Raize Components have a TRzFlowPanel UI component. Does exactly what you're after.
Use TRzFlowPanel to put an empty flow panel on a form. The major difference between a traditional panel and a flow panel is the way in which controls are placed. With a traditional panel, you place a control (such as a button) in a specific location. You can freely move that control to any location within the panel using the mouse. In a flow panel, each control is placed in a specific location, regardless of where you place it with the mouse. The automatic location is controlled by the FlowStyle property. For example, using the default FlowStyle property of LeftRightTopBottom, the first control you add to the flow panel snaps to the top left corner. The second control that you add snaps next to the first control, and so on.