PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 10
 1 
 on: Today at 08:31:16 AM 
Started by Paul Squires - Last post by Bumblebee
With this code I am seeing it on Windows 7. Aero theme off.

 2 
 on: July 02, 2020, 10:41:28 PM 
Started by Paul Squires - Last post by Josť Roca
I don't see such phenomenon.

Code: [Select]
#define UNICODE
#INCLUDE ONCE "Afx/CWindow.inc"
USING Afx

#define ID_INPUTBOX 101

DECLARE FUNCTION WinMain (BYVAL hInstance AS HINSTANCE, _
                          BYVAL hPrevInstance AS HINSTANCE, _
                          BYVAL szCmdLine AS ZSTRING PTR, _
                          BYVAL nCmdShow AS LONG) AS LONG

   END WinMain(GetModuleHandleW(NULL), NULL, COMMAND(), SW_NORMAL)

' // Forward declaration
DECLARE FUNCTION WndProc (BYVAL hwnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT

' ========================================================================================
' Main
' ========================================================================================
FUNCTION WinMain (BYVAL hInstance AS HINSTANCE, _
                  BYVAL hPrevInstance AS HINSTANCE, _
                  BYVAL szCmdLine AS ZSTRING PTR, _
                  BYVAL nCmdShow AS LONG) AS LONG

   ' // Set process DPI aware
   ' // The recommended way is to use a manifest file
   AfxSetProcessDPIAware

   ' // Creates the main window
   DIM pWindow AS CWindow
   ' -or- DIM pWindow AS CWindow = "MyClassName" (use the name that you wish)
   pWindow.Create(NULL, "CWindow with a button", @WndProc)
   ' // Sizes it by setting the wanted width and height of its client area
   pWindow.SetClientSize(500, 320)
   ' // Centers the window
   pWindow.Center

   ' // Adds a button
   pWindow.AddControl("Button", , ID_INPUTBOX, "&Input Box", 350, 250, 75, 23)

   ' // Displays the window and dispatches the Windows messages
   FUNCTION = pWindow.DoEvents(nCmdShow)

END FUNCTION
' ========================================================================================

' ========================================================================================
' Main window procedure
' ========================================================================================
FUNCTION WndProc (BYVAL hwnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT

   SELECT CASE uMsg

      CASE WM_COMMAND
         SELECT CASE GET_WM_COMMAND_ID(wParam, lParam)
            CASE IDCANCEL
               ' // If ESC key pressed, close the application by sending an WM_CLOSE message
               IF GET_WM_COMMAND_CMD(wParam, lParam) = BN_CLICKED THEN
                  SendMessageW hwnd, WM_CLOSE, 0, 0
                  EXIT FUNCTION
               END IF
            CASE ID_INPUTBOX
               ' // If ESC key pressed, close the application by sending an WM_CLOSE message
               IF GET_WM_COMMAND_CMD(wParam, lParam) = BN_CLICKED THEN
                  DIM cws AS CWSTR = AfxInputBox(hwnd, 0, 0, "InputBox test", "What's your name?", "My name is Josť")
                  EXIT FUNCTION
               END IF
         END SELECT

      CASE WM_SIZE
         ' // Optional resizing code
         IF wParam <> SIZE_MINIMIZED THEN
            ' // Retrieve a pointer to the CWindow class
            DIM pWindow AS CWindow PTR = AfxCWindowPtr(hwnd)
            ' // Move the position of the button
            IF pWindow THEN pWindow->MoveWindow GetDlgItem(hwnd, IDCANCEL), _
               pWindow->ClientWidth - 120, pWindow->ClientHeight - 50, 75, 23, CTRUE
         END IF

    CASE WM_DESTROY
         ' // Ends the application by sending a WM_QUIT message
         PostQuitMessage(0)
         EXIT FUNCTION

   END SELECT

   ' // Default processing of Windows messages
   FUNCTION = DefWindowProcW(hwnd, uMsg, wParam, lParam)

END FUNCTION
' ========================================================================================

 3 
 on: July 02, 2020, 02:14:55 PM 
Started by Paul Squires - Last post by Bumblebee
Thanks. Bookmarked :)

Edit: When x,y are set to zero, the input box can be briefly seen in the top left corner of the screen, before it is centered.
For the time being, I entered a 1/3,1/2 form position, and this avoids this small issue.

 4 
 on: July 02, 2020, 02:03:17 PM 
Started by Paul Squires - Last post by Josť Roca
See: https://github.com/JoseRoca/WinFBX/blob/master/docs/Windows%20GUI/CWindow%20Class.md#AfxInputBox

 5 
 on: July 02, 2020, 01:49:45 PM 
Started by Paul Squires - Last post by Bumblebee
I couldn't find it in the help file, I'm glad I found it here.

 6 
 on: June 29, 2020, 07:35:47 AM 
Started by Paul Squires - Last post by Bumblebee
I implemented your changes and the problem persists.
You should be able to observe a focus loss after an item is selected. I'm seeing this in several projects that don't involve the Ctx control.
On these windows it may be difficult to see since the focus trace line isn't visible on a list box item.

1. I select an item in the list box.
2. I press tab.
3. I notice I cannot select another item by pressing the arrow keys, or by rotating the mouse wheel. I notice that the tab control did not receive focus.
4. I press tab.
5. Focus is returned to the list box, as I can now do what I described in step 3.

This may be trivial for mouse users who click on everything, but for keyboard users this is weird.
I haven't created a test project but based on the sequence of steps in your post it makes sense that in #3 you cannot select another item by pressing arrow keys, etc because the focus would have already left the listbox control when you pressed the TAB key in step #2.

#1. Listbox item gets focus because you either selected it by code or by clicking on it.
#2. Pressing TAB will move the focus from the Listbox to whatever the next control is in the tab order.
#3. The Lisbox now does not have focus so you can't change items via keyboard. You mention tab control - you have a TabControl in your project? That wasn't in the sample project that you posted earlier.
#4. Pressing TAB probably moved the control back to the Listbox again (most likely from your PictureBox to the Listbox).
#5. Listbox has focus so you can change items via arrow keys.
I added a tab control, but it doesn't receive focus. I don't know if that is an issue.
If I create a form with a list box, text box and tab control, focus will not jump to the tab control.

On the project I submitted, the focus should never leave the list box. I'm assuming it is going to the image, and not the label.
The issue is similar that of the picture box control in Visual Basic. If enabled is true, a picture box will take the focus when tab is pressed.

See the attached project for another focus issue. Description is in the executable file.

 7 
 on: June 28, 2020, 04:21:30 PM 
Started by Paul Squires - Last post by Paul Squires
It appears that when the back color of an empty list box is changed, it will not show up, or will flicker.
Adding an item to the list box halts this behavior.
Thanks - I have added this to my to do list to check into.

 8 
 on: June 28, 2020, 04:20:40 PM 
Started by Paul Squires - Last post by Paul Squires
I implemented your changes and the problem persists.
You should be able to observe a focus loss after an item is selected. I'm seeing this in several projects that don't involve the Ctx control.
On these windows it may be difficult to see since the focus trace line isn't visible on a list box item.

1. I select an item in the list box.
2. I press tab.
3. I notice I cannot select another item by pressing the arrow keys, or by rotating the mouse wheel. I notice that the tab control did not receive focus.
4. I press tab.
5. Focus is returned to the list box, as I can now do what I described in step 3.

This may be trivial for mouse users who click on everything, but for keyboard users this is weird.
I haven't created a test project but based on the sequence of steps in your post it makes sense that in #3 you cannot select another item by pressing arrow keys, etc because the focus would have already left the listbox control when you pressed the TAB key in step #2.

#1. Listbox item gets focus because you either selected it by code or by clicking on it.
#2. Pressing TAB will move the focus from the Listbox to whatever the next control is in the tab order.
#3. The Lisbox now does not have focus so you can't change items via keyboard. You mention tab control - you have a TabControl in your project? That wasn't in the sample project that you posted earlier.
#4. Pressing TAB probably moved the control back to the Listbox again (most likely from your PictureBox to the Listbox).
#5. Listbox has focus so you can change items via arrow keys.

 9 
 on: June 28, 2020, 07:50:59 AM 
Started by Paul Squires - Last post by Bumblebee
It appears that when the back color of an empty list box is changed, it will not show up, or will flicker.
Adding an item to the list box halts this behavior.

Edit: This explains why I couldn't simulate a grayed out background in a list box yesterday. The list was empty.

 10 
 on: June 28, 2020, 07:35:49 AM 
Started by Paul Squires - Last post by Bumblebee
I implemented your changes and the problem persists.
You should be able to observe a focus loss after an item is selected. I'm seeing this in several projects that don't involve the Ctx control.
On these windows it may be difficult to see since the focus trace line isn't visible on a list box item.

1. I select an item in the list box.
2. I press tab.
3. I notice I cannot select another item by pressing the arrow keys, or by rotating the mouse wheel. I notice that the tab control did not receive focus.
4. I press tab.
5. Focus is returned to the list box, as I can now do what I described in step 3.

This may be trivial for mouse users who click on everything, but for keyboard users this is weird.

Pages: [1] 2 3 ... 10