PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Rolf Brandt on August 14, 2010, 02:38:28 AM

Title: Is anybody using PB 9.05
Post by: Rolf Brandt on August 14, 2010, 02:38:28 AM
Is anybody using PB 9.05 already?

If so, did you notice any problems? So far it seems I have two major problems with my compiled exes:

1. Textboxes: If I use German Umlaute  (mutated vowels like äöüÃ,,ÖÜ) in a multiline textbox the textbox will produce something like a carriage return or linefeed before and after each of these letters. Umlauts are used frequently in German, Turkish, and other languages. So this is a real problem.

2. WM_KeyDown Event of a Textbox: When trying to catch nVirtKey %VK_Retrun is not working anymore. So a couple of my routines do not work anymore. As workaround I can catch it if I evaluate %WM_GETDLGCODE in the custom event of the form.

Any observations from you?

How can I set PB back to 9.04? can I just install the 9.04 update over 9.05? Or would I have to reinstall from the beginning?.


Title: Re: Is anybody using PB 9.05
Post by: José Roca on August 14, 2010, 03:28:06 AM
Yes, I'm using it without problems. Besides, I can't see how the compiler could change the behavior of an edit control, unless you're using DDT.

A quick test using my headers:


#COMPILE EXE
#DIM ALL

%USEMACROS = 1                ' // Use macros
#INCLUDE ONCE "CWindow.inc"   ' // CWindow class
#INCLUDE ONCE "winctrl.inc"   ' // Window wrapper functions

%IDC_EDIT = 101

' ########################################################################################
' Main
' ########################################################################################
FUNCTION WinMain (BYVAL hInstance AS DWORD, BYVAL hPrevInstance AS DWORD, BYVAL lpszCmdLine AS ASCIIZ PTR, BYVAL nCmdShow AS LONG) AS LONG

   ' // Create an instance of the class
   LOCAL pWindow AS IWindow
   pWindow = CLASS "CWindow"
   IF ISNOTHING(pWindow) THEN EXIT FUNCTION

   ' // Create the main window
   LOCAL hwnd AS DWORD
   hwnd = pWindow.CreateWindow(%NULL, "SDK Window", 0, 0, 500, 350, -1, -1, CODEPTR(WindowProc))
   Window_Center hwnd

   ' // Add a multiline edit control
   LOCAL hEdit AS DWORD
   hEdit = pWindow.AddTextBox(hwnd, %IDC_EDIT, "", 100, 50, 300, 150, _
      %WS_CHILD OR %WS_VISIBLE OR %ES_MULTILINE OR %WS_VSCROLL OR %WS_HSCROLL OR %ES_AUTOHSCROLL OR %ES_AUTOVSCROLL OR %ES_NOHIDESEL, 0, _
      CODEPTR(Edit_SubclassProc))
   SetFocus hEdit

   ' // Button control
   pWindow.AddButton(hwnd, %IDCANCEL, "&Close", 350, 250, 75, 23, -1, -1)

   ' // Default message pump (you can replace it with your own)
   pWindow.DoEvents

END FUNCTION
' ########################################################################################

' ========================================================================================
' Main callback function.
' ========================================================================================
FUNCTION WindowProc (BYVAL hwnd AS DWORD, BYVAL uMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS LONG) AS LONG

   SELECT CASE uMsg

      CASE %WM_COMMAND
         SELECT CASE LO(WORD, wParam)
            CASE %IDCANCEL
               IF HI(WORD, wParam) = %BN_CLICKED THEN
                  SendMessage hwnd, %WM_CLOSE, 0, 0
                  EXIT FUNCTION
               END IF
         END SELECT

      CASE %WM_DESTROY
         ' // Close the main window
         PostQuitMessage 0
         EXIT FUNCTION

   END SELECT

   FUNCTION = DefWindowProc(hwnd, uMsg, wParam, lParam)

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

' ========================================================================================
' Processes messages for the subclassed edit control.
' ========================================================================================
FUNCTION Edit_SubclassProc ( _
   BYVAL hwnd   AS DWORD, _                 ' // Control window handle
   BYVAL uMsg   AS DWORD, _                 ' // Type of message
   BYVAL wParam AS DWORD, _                 ' // First message parameter
   BYVAL lParam AS LONG _                   ' // Second message parameter
   ) AS LONG

   ' // REQUIRED: Get the address of the original window procedure
   LOCAL pOldWndProc AS DWORD
   pOldWndProc = GetProp(hwnd, "OLDWNDPROC")

   SELECT CASE uMsg
      CASE %WM_KEYDOWN
         IF wParam = %VK_RETURN THEN
            LOCAL hOldFocus AS DWORD
            hOldFocus = GetFocus
            MSGBOX "Return key pressed"
            SetFocus hOldFocus
         END IF
      CASE %WM_DESTROY
         ' // REQUIRED: Remove control subclassing
         SetWindowLong hwnd, %GWL_WNDPROC, RemoveProp(hwnd, "OLDWNDPROC")
   END SELECT

   FUNCTION = CallWindowProc(pOldWndProc, hwnd, uMsg, wParam, lParam)

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

Title: Re: Is anybody using PB 9.05
Post by: Rolf Brandt on August 14, 2010, 05:16:18 AM
Thanks, Jose. I could not imagine that either. I just wonder what else happened.
Title: Re: Is anybody using PB 9.05
Post by: Roger Garstang on August 16, 2010, 12:05:51 PM
I haven't had any problems either. I don't use the chars mentioned, but for the 2nd I'd check styles like Multiline and WantReturn (Might check the Default button too since where you are able to capture it sounds like the message it is getting and either it is not multiline or isn't getting the Enter key).  I think the only problem I've had all week is forgetting PB variable names are not case sensitive.  I tend to make globals like MyVariable and a local or function parameter like myVariable.  Spent a couple hours debugging code due to that.  The PB help wasn't much help either as it just talks about case in Labels, but not Variables.
Title: Re: Is anybody using PB 9.05
Post by: José Roca on August 16, 2010, 01:05:07 PM
Quote from: Rolf Brandt on August 14, 2010, 05:16:18 AM
Thanks, Jose. I could not imagine that either. I just wonder what else happened.

Strange behaviors like that are most often caused by memory corruption.