Why does TDisplay.Index differ from the Windows Index? - firemonkey

I want to list the displays on a system in the same sequence as they are indexed on Windows Settings.
I have two monitors attached to my system, but in Delphi the Screen.Displays array appears to be in the wrong sequence E.G. With two horizontally positioned displays, Display Index 0 relates to the rightmost display which is listed as display 2 in Windows Settings. Likewise, Display Index 1 relates to the leftmost display which is listed as display 1 in Windows Settings. How can I be certain to get the Indexes in the same order as they are listed within the operating system (PC and Mac)?

Related

Creating a "dead area" on the Windows desktop

One of our applications duplicates an area in the top left corner of the monitor and displays it to the public. Any of our other applications are prevented from covering this area, you cannot drag any of them over this area (they hit a "wall"), otherwise they would be visible publicly. However, if a user starts another application, say IE, it can display over the restricted area. Is there a registry setting or something that we can set that will prevent ALL applications from using this part of the desktop, eg. 300x200. I could set this value when our program starts and restore it when it closes, and have a separate application just to restore it just in case! It is not a serious limitation if the whole of the side or top could not be used, ie. if we block out the whole first 300 pixels on the left this would be acceptable. We are running W7-10 depending on the customer, programming is done in Delphi XE (at the moment).

Order array of windows by z order

I read this about stack order / z order of windows on X11:
To obtain good interoperability between different Desktop Environments, the following layered stacking order is recommended, from the bottom:
windows of type _NET_WM_TYPE_DESKTOP
windows having state _NET_WM_STATE_BELOW
windows not belonging in any other layer
windows of type _NET_WM_TYPE_DOCK (unless they have state _NET_WM_TYPE_BELOW) and windows having state _NET_WM_STATE_ABOVE
focused windows having state _NET_WM_STATE_FULLSCREEN
I was able to use get the _NET_WM_USER_TIME atom to order windows. I used XQuerySubtree and XGetWindowProperty. But it's not the best solution, as lots of times it gets the window before the most recent window. Code here: https://gist.github.com/Noitidart/60aab0a96f060240614f
I was wondering if there was a way to get windows by z order?
Moved from comments:
XQueryTree does return children sorted by stacking order:
The children are listed in current stacking order, from bottommost (first) to topmost (last)
Answer to "is there any way to do a quick test if the window is visible in task bar / task switcher" is "check if it's _NET_WM_WINDOW_TYPE_NORMAL window"

What does screen number and display number mean in Xlib?

For example, the foobar:0.1 would specify screen 1 of display 0 on the machine named foobar.
But what does screen number and display number of X server mean in Xlib?
Does it mean that an X server can have many displays, and a display can have many screens, and a screen can have many windows?
"Display" in xlib / x11 protocol terminology is one single connection between client and X server.
"Screen" is actual screen, but things get more complicated here. Each screen has its own root window ( and some more associated properties - physical width/heights, DPI etc ). Because every window on the screen is child of that root window, you can't just move window from one screen to another (all child windows under X11 always clipped by parent). This is one of the reason multiple "screens" as in your question almost never used - most people have multiple monitors configured to be part of one X11 screen using Xinerama/RANDR extensions
To summarise: one display - one connection (if over network, to a port 6000 + display number). Each screen - it's own root window. One client is allowed to have more than one connection to X ( and thus use multiple Display instances )

Difficult changing groups in Crystal Reports 12 due to windows size. Resizable?

This is in Crystal Reports 2008 version 12.2.0.290
I am working on a report a previous employee created. I want to change one of the groups but the window size is too small to see the full field name and I don't see any way to resize it or to see the entire field name. Many of the groups are different only by the right most portion of the field name for example Here are groups 1-4:
SUMMARY_AGED_ACCOUNTS_RECIEVABLE_1
SUMMARY_AGED_ACCOUNTS_RECIEVABLE_2
SUMMARY_AGED_ACCOUNTS_RECIEVABLE_3
SUMMARY_AGED_ACCOUNTS_RECIEVABLE_4
Since I can't see all the way to the right it is an annoying process of trial and error.
Secondly in design and previous views the section chooser area to the left is too small and truncates the field name in a similar manner. Is there anyway to resize these portions of the program? Is there another area of the program where I can choose groups and see the entire field? You can see what I mean in the screenshot below.

List Control Adds a Space for an Image to Column 0 When Subsequent Columns Have Images

I’ve come across a problem with Windows list controls (I am specifically using MFC, but it looks like it applies to all list controls in the Windows common controls library).
In my specific case, I want to create a list control that has two or more columns. The first column (0) is text-only and is used to allow the user to jump to entries by typing the text in that row. Column two (or three, or four, or whatever) has an image (or an image and text; either way).
This much is all well and good and can be done easily without problem, however the final list control then ends up having a space to the left of the text in column 0 (it may be on the right on an RTL system). This spacer appears to be reserved for an image and I cannot figure out a way to prevent it. (Arranging the specific order of the columns did not change anything.)
Looking around, I found some other people complaining of the same thing, specifically this thread which leads to this thread. The proposed solution does not work because as was stated, simply shrinking the width of column zero merely cuts off the text rather than the image spacer (plus, you then have to prevent and/or process any changes to column widths that the user tries to make).
Does anyone have any ideas of how to fix this bug short of writing a list control from scratch or using one of the too-fancy grid controls on CodeProject/CodeGuru/etc.?
Thanks a lot.
Did you try to change the iIndent member of the LVITEM struct? MSDN says this:
iIndent Version 4.70. Number of image widths to indent the item. A
single indentation equals the width of
an item image. Therefore, the value 1
indents the item by the width of one
image, the value 2 indents by two
images, and so on. Note that this
field is supported only for items.
Attempting to set subitem indentation
will cause the calling function to
fail.
Column 0 is special in a ListView. As soon as you assign a small image list to the ListView, the control expects you to show an image in column 0, so it leaves space for it.
Solutions:
make column 0 zero-width, give it the value you want the user to be able to type. Column 1 becomes your "first" text column. Columns 2+ are for your images. You need full row select style for this to work. Yes, you have to prevent the user from resizing column 0. Yes, that is a pain.
make a column that does have an image to be column 0 and use LVM_SETCOLUMNORDERARRAY to rearrange the display order
owner draw the items.
give column 0 an icon (just to cover all bases)

Resources