Windows GUI
-
- Posts: 437
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: Windows GUI
What is a message pump?
I studied a little bit the different window styles in the documentation about CreateWindow in win32_fb.chm and saw that you must use the WS_TAB style and the WS_GROUP style for the relevant controls. Is this additional necessary? Could you please give a short example?
I studied a little bit the different window styles in the documentation about CreateWindow in win32_fb.chm and saw that you must use the WS_TAB style and the WS_GROUP style for the relevant controls. Is this additional necessary? Could you please give a short example?
Re: Windows GUI
https://en.wikipedia.org/wiki/Message_l ... ft_WindowsLothar Schirm wrote:What is a message pump?
-
- Posts: 564
- Joined: Sep 27, 2016 18:20
- Location: Valencia, Spain
Re: Windows GUI
> What is a message pump?
Your function WaitEvent is a message pump. However, you are not using IsDialogMessage in it; therefore the TAB key isn't being processed.
This one uses IsDialogMessage
Of course, which one you should use depends of what you intend to do.
Your function WaitEvent is a message pump. However, you are not using IsDialogMessage in it; therefore the TAB key isn't being processed.
Code: Select all
Function WaitEvent(ByRef msg As MSG) As Integer
'Wait for an event (mouse click). Returns a result <> 0 if a Windows message
'has been received
Dim As Integer result
result = GetMessage(@msg, 0, 0, 0)
If result <> 0 Then
TranslateMessage(@msg )
DispatchMessage(@msg )
End If
Return result
End Function
Code: Select all
WHILE (GetMessage(@msg, NULL, 0, 0) <> FALSE)
IF IsDialogMessage(hWndMain, @msg) = 0 THEN
TranslateMessage(@msg)
DispatchMessage(@msg)
END IF
WEND
See: https://msdn.microsoft.com/en-us/librar ... s.85).aspxAlthough the IsDialogMessage function is intended for modeless dialog boxes, you can use it with any window that contains controls, enabling the windows to provide the same keyboard selection as is used in a dialog box.
When IsDialogMessage processes a message, it checks for keyboard messages and converts them into selections for the corresponding dialog box. For example, the TAB key, when pressed, selects the next control or group of controls, and the DOWN ARROW key, when pressed, selects the next control in a group.
Because the IsDialogMessage function performs all necessary translating and dispatching of messages, a message processed by IsDialogMessage must not be passed to the TranslateMessage or DispatchMessage function.
-
- Posts: 437
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: Windows GUI
Thank you very much, this seems to be a very useful information. I will try to integrate that into my WinGUI. It should be as simple as before, but there are of course other more complex packages for users who need more features, for example:
1. Your library CWindow on PlanetSquires Forums http://www.planetsquires.com/protect/fo ... board=39.0. I think Paul Squires uses it for his new FreeBASIC IDE.
2. Vanya's Window9 http://www.freebasic.net/forum/viewtopi ... lit=FBGUI2 which is nearly a complete PureBASIC clone.
1. Your library CWindow on PlanetSquires Forums http://www.planetsquires.com/protect/fo ... board=39.0. I think Paul Squires uses it for his new FreeBASIC IDE.
2. Vanya's Window9 http://www.freebasic.net/forum/viewtopi ... lit=FBGUI2 which is nearly a complete PureBASIC clone.
Re: Windows GUI
2. Vanya's Window9 http://www.freebasic.net/forum/viewtopi ... lit=FBGUI2 which is nearly a complete PureBASIC clone.[/quote]
Lothar
I have looked at Window9 and, being also a PureBASIC user, would love to use it. Unfortunately, I have never been able to get it to work. I downloaded Window9 from Sourceforge and set up a directory LIBFB in Freebasic, transferred the .bi files into "inc" and then tried some of the example files. I couldn't get any of them to work and there were too many errors to list, although most of them seem to come from other .bi files (not those specifically included in Windows9). I've not set up any difficult compiler requirements, just a basic set up (FreeBASIC as installed).
I went on the internet and others seem to have had similar problems.
It's a great shame because I would like to try it out.
Ray
Lothar
I have looked at Window9 and, being also a PureBASIC user, would love to use it. Unfortunately, I have never been able to get it to work. I downloaded Window9 from Sourceforge and set up a directory LIBFB in Freebasic, transferred the .bi files into "inc" and then tried some of the example files. I couldn't get any of them to work and there were too many errors to list, although most of them seem to come from other .bi files (not those specifically included in Windows9). I've not set up any difficult compiler requirements, just a basic set up (FreeBASIC as installed).
I went on the internet and others seem to have had similar problems.
It's a great shame because I would like to try it out.
Ray
Re: Windows GUI
EDIT: not sure why I was having case issues. Re-tested and things compile fine.
Fired up Windows 10 tonight and downloaded this Window9 library. I was able to get things to compile,but I had to make sure the #include directives in the source file and in windows9.bi matched the exact case of the include files in my freebasic installation. This was completely unexpected. Almost looks to me like the compiler is case-sensitive when specifying include files. This is normal on *nix machine, but not at all Windows. Maybe dkl or fxm can comment on this. Seems like a bug to me. Seems like FBC should simply try to open the file via the OS and let the OS do things in either a case-sensitive or case-insensitive way.
Fired up Windows 10 tonight and downloaded this Window9 library. I was able to get things to compile,
Last edited by caseih on Oct 20, 2016 15:08, edited 1 time in total.
-
- Posts: 564
- Joined: Sep 27, 2016 18:20
- Location: Valencia, Spain
Re: Windows GUI
It allows to easily create GUIs that are unicode and High DPI aware. Because of the lack of support for dynamic unicode strings in FB, I have needed to implement it as a class, CWSTR, that almost behaves as if it was a native data type. Support for unicode and High DPI have become very important.1. Your library CWindow on PlanetSquires Forums http://www.planetsquires.com/protect/fo ... board=39.0. I think Paul Squires uses it for his new FreeBASIC IDE.
-
- Posts: 437
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: Windows GUI
I used Window9 more than 2 years ago with Windows 8.1. I do not know how it works now. If you need support, please contact the project site (see my post dated Oct 16).
-
- Posts: 437
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: Windows GUI
@Provoni, RNBW, ...
I ask your and other people's opinion regarding Josep Roca's proposal for using the TAB key. The modification of WinGUI.bi is nearly ready and tested so far. I could do the following:
1. Use WS_TABSTOP in CreateWindowEx for each control so that the user can use the TAB key to change between all controls of a window
2. Use WS_TABSTOP in CreateWindowEx only for editboxes so that the user can use the TAB key to change between all editboxes of a window
3. Use WS_TABSTOP in the function .._New (e.g. EditBox_New, Button_New, ListBox_New,...) as a default parameter "Style" (e.g.
for each control
4. Use WS_TABSTOP only in the function EditBox_New as a default parameter "Style" (e.g.
only for editboxes
Solutions 3 and 4 give the user also the possibility to use the WS_GROUP style so that he can select between group of controls, or he may set Style = 0 if he does not want to use TAB keys.
What would you like? (I prefer solution 3)
I ask your and other people's opinion regarding Josep Roca's proposal for using the TAB key. The modification of WinGUI.bi is nearly ready and tested so far. I could do the following:
1. Use WS_TABSTOP in CreateWindowEx for each control so that the user can use the TAB key to change between all controls of a window
2. Use WS_TABSTOP in CreateWindowEx only for editboxes so that the user can use the TAB key to change between all editboxes of a window
3. Use WS_TABSTOP in the function .._New (e.g. EditBox_New, Button_New, ListBox_New,...) as a default parameter "Style" (e.g.
Code: Select all
Function EditBox_New(ByVal x As Long, ByVal y As Long, ByVal w As Long, ByVal h As Long, ByVal Text As String, ByVal Style As ULong = WS_TABSTOP, ByVal hwnd As HWND) As HWND
4. Use WS_TABSTOP only in the function EditBox_New as a default parameter "Style" (e.g.
Code: Select all
Function EditBox_New(ByVal x As Long, ByVal y As Long, ByVal w As Long, ByVal h As Long, ByVal Text As String, ByVal Style As ULong = WS_TABSTOP, ByVal hwnd As HWND) As HWND
Solutions 3 and 4 give the user also the possibility to use the WS_GROUP style so that he can select between group of controls, or he may set Style = 0 if he does not want to use TAB keys.
What would you like? (I prefer solution 3)
Re: Windows GUI
EDIT: I'm not sure why I got this behavior. I can't reproduce this problem anymore.Lothar Schirm wrote:I used Window9 more than 2 years ago with Windows 8.1. I do not know how it works now. If you need support, please contact the project site (see my post dated Oct 16).
Now I understand that includes are case sensitive when using a case-sensitive file system (C programmers have had to deal with this for years when porting between Windows and Linux), but on Windows it should not care. Can you confirm this case-sensitive behavior on your system? I'm using FBC 1.05.
Last edited by caseih on Oct 20, 2016 15:08, edited 1 time in total.
-
- Posts: 564
- Joined: Sep 27, 2016 18:20
- Location: Valencia, Spain
Re: Windows GUI
Using Windows 7 ad FBC 1.05, it doesn't matter which case do you use. Even "wInDOwS.bI" works.
Re: Windows GUI
LotharLothar Schirm wrote:@Provoni, RNBW, ...
I ask your and other people's opinion regarding Josep Roca's proposal for using the TAB key. The modification of WinGUI.bi is nearly ready and tested so far. I could do the following:
1.......
2.......
3.......
4.......
What would you like? (I prefer solution 3)
I agree with you. If WS_TABSTOP is in all the controls then it it's available to the user. If the user doesn't want to use the tabbing feature, then simply don't use it.
Ray
-
- Posts: 564
- Joined: Sep 27, 2016 18:20
- Location: Valencia, Spain
Re: Windows GUI
Well, almost all, except static controls such labels or group boxes, and also controls like toolbars, status bars, progress bars, headers, rebars, size bars, updown.
Last edited by Josep Roca on Oct 19, 2016 4:40, edited 1 time in total.
Re: Windows GUI
Freebasic 1.05 on Windows 10 seems to ignore case.caseih wrote:It doesn't work now because somewhere along the line it appears that FBC started making #includes case-senstive
Re: Windows GUI
Yeah I tested it again and I can't replicate the behavior, even when using shared drives from Linux.