FBGUI library for Windows 2

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
VANYA
Posts: 1323
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Postby VANYA » Feb 01, 2019 13:37

Coolman wrote: but why gtk *. did you think about FLTK ? https://www.fltk.org/


Probably because GTK is more widespread, better help. More people can help, if some sort of problem.
enform
Posts: 175
Joined: Apr 24, 2011 12:57
Location: France

Re: FBGUI library for windows 2

Postby enform » Feb 02, 2019 22:06

Hi Vanya,

Yes , good news . Even if I've never used GTK ...
You are one of the benefactors of this forum !
What is your editor under Linux ? Geany ?

I read : AESrypt.bas and the 'C' ? :)
I translated the 2 txt files in English : Easy ! ... ;-) ( if you want to add )


RemarkEn.txt

Code: Select all



This file describes all cross-platform functions of window9 library.
The main attention is paid to distinctions with functions on the Windows platform.
I tried to minimize distinctions, but because of the fact that initially the library was not
it is intended for other platforms except Windows, distinction often considerable.
If function is completely compatible, then except its name there are no hints!
Perhaps in the future I will make the normal help file for now it is necessary to use
just the file of hints the help file for windows .

////////////////////////////////////////////////////////////////////////////////////////

AddComboBoxImageItem

AddComboBoxItem

AddListBoxItem

AddListViewColumn (the parameters iStyleColumnTEXT, iStyleMask are not used)

AddListViewItem ((in the iMaskItem parameter only styles LVIF_TEXT, LVIF_IMAGE are used)

AddTreeViewItem  (in the iPos parameter the constant TVI_SORT will not bring result)

AESDecoder

AESEncoder

BGR

ButtonGadget (the style parameter can accept only two values:
 0 - ordinary button
 BS_PUSHLIKE - toggle the button)

ButtonImageGadget (the style parameter can accept only two values:
 0 - ordinary button
 BS_PUSHLIKE - toggle the button)

   
CalendarGadget (the style parameter is not used)

CenterWindow

CheckBoxGadget (the style parameter is not used)

ClearString

Close_File

Close_window

CloseFBini

ColorRequester

ComboBoxGadget (the iStyle parameter is not used)

ComboBoxImageGadget (the sizeicon and style parameters are not used)

CompressFile

CompressMem

ContainerGadget

CopyDir (the iFlag parameter is not used)

Copy_Image

CountItemComboBox

CountItemListBox

CreateCopyImageDesktop

CreateCopyImageRect (the optional iFlag parameter, specific to Linux is added)

CreateCopyImageWindow (the optional iFlag parameter, specific to Linux is added)

CreateDir

Create_File

CreateFBini

Create_Image

Decode64

DeCompressFile

DeCompressMem

DeleteComboBoxItem

DeleteDir (the iFlag parameter is not used)

DeleteFile (in parameter the line, but not the address as in Windows is routed live)

DeleteIndexImageListView (For Linux this function is not required as the widget does not store images but only pointers on images)

DeleteItemListView (it is undesirable to use this function in events from ListViewGadget)

DeleteListBoxItem

DeleteListViewColumn

DeleteListViewItemsAll

DeleteTreeViewItem

DirectoryEntryAttributes

DirectoryEntryDate (time of creation of the file returns incorrectly)

DirectoryEntryName

DirectoryEntrySize

DisableGadget

DisableWindow (does inactive only kliyensky area of a window (that is all gadgets placed at a window).
 The window continues to take actions from the user for window title (maximize |minimize| close) and also drag and drop)
 
EditorGadget (style can be:
 GTK_SHADOW_NONE - without frame {by default}
 GTK_SHADOW_IN , GTK_SHADOW_OUT , GTK_SHADOW_ETCHED_IN , GTK_SHADOW_ETCHED_OUT  - с рамкой
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 the tag parameter { only for Linux } can be:
  0 - to default, at this tag for highlighting of selection of the text it will be created automatically with colors bg "#8EAD6F", fg "#FFFFFF"
  1 - it is necessary to create tag most before SetSelectTextEditorGadget function use, but after EditorGadget function use. The name should be "gui_tag_bg_fg". Example of creation:
  dim as GtkTextBuffer ptr  buffer
  buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( gadgetid(NUMBER_GADGET) ))
  gtk_text_buffer_create_tag(buffer, "gui_tag_bg_fg","background", "#444444", "foreground", "#FFFFFF", NULL)


Decode64

E_O_F

ExamineDirectory

FastCopy

FastCRC32

FileComboBoxItem (differences in the last iAttribut parameter).
 For windows parameter can include flags:
  DDL_ARCHIVE , DDL_DIRECTORY , DDL_DRIVES , DDL_EXCLUSIVE , DDL_HIDDEN , DDL_READONLY , DDL_READWRITE , DDL_SYSTEM
 For Linux parameter can include flags:
  fbReadOnly , fbHidden , fbSystem , fbDirectory , fbArchive , fbNormal

      
FileListBoxItem (отличия в последнем параметре iAttribut).
   Для windows параметр может включать флаги:
      DDL_ARCHIVE , DDL_DIRECTORY , DDL_DRIVES , DDL_EXCLUSIVE , DDL_HIDDEN , DDL_READONLY , DDL_READWRITE , DDL_SYSTEM
   For Linux parameter can include flags:
      fbReadOnly , fbHidden , fbSystem , fbDirectory , fbArchive , fbNormal      

FindItemComboBox

FindItemListBox

FinishDirectory

FlagKeyListView (returns the same numbers when clicking the SHIFT keys, ctrl, shift ctrl, ctrl alt, as in Windows (it is important: only in the English layout).
    In other cases or there is no opportunity to use a key (for example in a case with ALT)
    Or returns numbers specific to Linux (for example at the clicked CAPS or in other layout)

FreeGadget

Free_Image

GadgetHeight

GadgetID

GadgetWidth

GadgetX

GadgetY

GetColumnListView (It is necessary to check only in EventGadget event)

GetColumnWidthListView

GetComboBoxText

GetCountItemTreeView

GetCurentDir

GetCurrentIndexCharEditor

GetExtensionPart

GetFilePart

Get_File_Pointer

GetGadgetColor (is not completed)

GetGadgetState

GetGadgetText

GetIndexImageTreeView (For Linux this function is not required as the widget does not store images but only pointers on images)

GetItemComboBox

GetItemCountListView

GetItemListBox

GetItemListView

GetItemTreeView (the required parameter iGadget is added)

GetLineCountEditor

GetLineTextEditor (the third iSizeBuffer parameter is not used)

GetListBoxText

GetModifyEditor

GetPathPart

GetSelectTextEditorGadget

GetSelCountListBox

GetSelectedCountListView (the optional iArray parameter is added. It is possible to return indexes of all selected points to it)

GetSelectedListViewItem (the iMask parameter is not used)

GetStateCalendar (does not return a day of the week, that is bFlag = returns 3 nothing)

GetSubItemListView

GetTextItemListView

GetTextTreeView

GetTrackBarPos

GetTopIndexListBox

GetWindowText

GlobalMouseX

GlobalMouseY

Grab_Image

HideGadget

HideWindow

HyperLinkGadget

ImageGadget (style1 and style2 parameters are not used)

Image_Height

Image_Width

InputBox

InsertString

IsMouseOver

KillTimer

LenItemTextComboBox

LenItemTextListBox

ListBoxGadget (the iStyle parameter can be: LBS_SORT, LBS_EXTENDEDSEL; iStyle2 parameter is not used)

ListViewGadget (works only in the mode of detailed viewing LVS_REPORT, other modes are not implemented)
 iExStyle (can be: LVS_EX_GRIDLINES, LVS_EX_SUBITEMIMAGES is always included; the others are not used)
 iStyle (only styles LVS_NOCOLUMNHEADER, LVS_SINGLESEL are available)
 iStyle2 (is not used)
 SizeIcon (it is not used, the size depends on the size of icons \images)
 StyleIcon (it is not used, the size depends on the size of icons \images)

Load_Image (the ColorBack parameter is not used, it seems and so all with transparency....)

MD5createHash

MD5createFileHash

MessBox (the flag parameter prinimt only two values:
 MB_OK - the normal message;
 MB_YESNO - the message with the questions YES\No, at the same time a returned value of IDYES or IDNO)
 the optional ParentWin parameter for installation of a parent window for dialog is added.
 If not to point a parent window to Linux, then in the terminal warning gets out (at least with GTK3)
 This warning does not bear any problem for the program so if it does not disturb the user,
 that the ParentWin parameter can be not used as well as on Windows. 

MouseX

MouseY

MoveDir (the iFlag parameter is not used)

MoveItemTreeView

NextDirectoryEntry

Open_File

OpenFBini

OpenFileRequester (the optional ParentWin parameter for installation of a parent window for dialog is added.
 If not to point a parent window to Linux, then in the terminal warning gets out (at least with GTK3)
 This warning does not bear any problem for the program so if it does not disturb the user,
 that the ParentWin parameter can be not used as well as on Windows.)

OpenWindow (the style parameter can accept only these parameters:
 WS_POPUP - a window without frame
 WS_VISIBLE - a visible window
 WS_OVERLAPPEDWINDOW - a window with a frame
 WS_MAXIMIZE - the window which is originally unrolled
 WS_MINIMIZE - the window which is originally minimized
 style2 parameter is not used)

OptionGadget (the style parameter is not used)

PasteEditor

PeekS

ProgressBarGadget (for GTK3 the iStyle parameter is not used)

Read_Byte

Read_Character

Read_Data

Read_DataA

Read_DataS

Read_Double

Read_File

Read_Integer

Read_Longint

ReadByteValueFBini

ReadDoubleValueFBini

ReadIntegerValueFBini

ReadLongintValueFBini

ReadOnlyEditor

ReadShortValueFBini

ReadStringValueFBini

Read_Single

Read_String

Read_Word

RenameDir (the iFlag parameter is not used)

RenameItemTreeView

ReplaceImageItemTreeView

ReplaceImageListView (not compatible to Windows implementation function)

ReplaceString

ReplaceTextColumnListView

ReplaceTextItemListView

ResetAllComboBox

ResetAllListBox

ResizeGadget

Resize_Image

ResizeWindow

Rotate4_Image

SaveFileRequester (the iDefaultSetPattern parameter is not used)

Save_Image

SetColumnWidthListView

SetCurentDir

Set_File_Pointer

SetGadgetColor (is not completed)

SetGadgetState

SetGadgetText

SetItemComboBox

SetItemListBox

SetModifyEditor

SetRangeProgressBar

SetSelectListViewItem

SetSelectManyItem

SetSelectTextEditorGadget (we read attentively about the tag parameter in the description of EditorGadget)

SetStateCalendar

SetTimer (1 HWND parameter is not used)

SetTopIndexListBox

SetTrackBarMaxPos (the iFlag parameter is not used)

SetTrackBarMinPos (the iFlag parameter is not used)

SetTrackBarPos

SetTransferTextLineEditorGadget

SetWindowText

SetWindowTop

SHA1create

SHA1createFile

SHA512create

SHA512createFile

ShowListComboBox

Size_File

SpinGadget

StringGadget (the style parameter can be: ES_PASSWORD, ES_READONLY; style2 parameter is not used)

TextGadget (the style parameter can accept one of three values: SS_LEFT, SS_RIGHT, SS_CENTER)

TrackBarGadget (the Style parameter can accept values: TBS_HORZ, TBS_VERT)

TreeViewGadget (the parameters iStyle, iStyle2, iSizeIcon are not used)

UpdateItem (For Linux it is not required)

UseGadgetList

WaitEvent

WebGadget (style { only for GTK2 } can be:
 GTK_SHADOW_NONE - without frame {by default}
 GTK_SHADOW_IN , GTK_SHADOW_OUT , GTK_SHADOW_ETCHED_IN , GTK_SHADOW_ETCHED_OUT  - с рамкой
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 style2 is not used

WebGadgetGetBody (Function works only in the library compiled with GTK2.
    In difference from Windows of the version, function returns html codes of all HTML page).
    At function call with GTK3, in the terminal there will be a hint, than it is possible to replace the WebGadgetGetBody function
    The iFlag parameter is not used
WebGadgetGetURL

WebGadgetGoBack
   
WebGadgetGoForward
 
WebGadgetNavigate

WebGadgetRefresh

WebGadgetSetBody (In difference from Windows of the version, function sets to HTML codes of all HTML page)

      
WebGadgetState      

WindowBounds

WindowColor

WindowEvent

WindowHeight

WindowWidth

WindowX

WindowY

Write_Byte

Write_Character

Write_Data

Write_Double

Write_Integer

Write_Longint

Write_Single

Write_String

Write_StringN

Write_Word

WriteGroupFBini


Management of colors .txt

Code: Select all

GTK3

1) buttongadget          +-       (только цвет текста)
2) editorgadget          ++
5) TextGadget             ++
6) StringGadget          +-       (только цвет текста и цвет его выделения мышью)
7) SpinGadget             +-       (только цвет текста и цвет его выделения мышью)
8) CalendarGadget          ++
9) CheckBoxGadget         ++
10) OptionGadget         ++
11) HyperLinkGadget         ++
12) TrackBarGadget         ++
15) ListBoxGadget          ++    
16) GroupGadget            ++
19) ListViewGadget         ++
 
GTK2

1) buttongadget          +-       (только цвет текста)
2) editorgadget          ++
5) TextGadget             ++      
6) StringGadget          ++       
7) SpinGadget             ++
8) CalendarGadget          ++
9) CheckBoxGadget         +-      (только цвет текста)
10) OptionGadget         +-      (только цвет текста)
15) ListBoxGadget          ++
18) ProgressBarGadget      ++
19) ListViewGadget         ++

English :

1) buttongadget - (only text color)
2) editorgadget     
5) TextGadget       
6) StringGadget - (only text color and color of its selection by a mouse)
7) SpinGadget - (only text color and color of its selection by a mouse)
8) CalendarGadget     
9) CheckBoxGadget     
10) OptionGadget     
11) HyperLinkGadget     
12) TrackBarGadget     
15) ListBoxGadget       
16) GroupGadget     
19) ListViewGadget     
 
GTK2

1) buttongadget - (only text color)
2) editorgadget     
5) TextGadget         
6) StringGadget         
7) SpinGadget       
8) CalendarGadget     
9) CheckBoxGadget - (only text color)
10) OptionGadget - (only text color)
15) ListBoxGadget       
18) ProgressBarGadget   
19) ListViewGadget
VANYA
Posts: 1323
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Postby VANYA » Feb 03, 2019 6:11

Hi enform! Thank you for your flattering review!

I read : AESrypt.bas and the 'C' ? :)


I do not understand about what speech

What is your editor under Linux ? Geany ?


IUP_FB_EDITOR

I translated the 2 txt files in English


file Remark will be constantly updated , so it is not necessary to translate (while don't need ).
enform
Posts: 175
Joined: Apr 24, 2011 12:57
Location: France

Re: FBGUI library for windows 2

Postby enform » Feb 03, 2019 9:28

AESrypt.bas or AESCrypt.bas ?

Oh yes , ATM i forgot your new IDE ...
VANYA
Posts: 1323
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Postby VANYA » Feb 03, 2019 13:19

enform wrote:AESrypt.bas or AESCrypt.bas ?


This bug is still in windows version :)

Thank you, fixed on the local disk.
VANYA
Posts: 1323
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Postby VANYA » Feb 19, 2019 11:36

enform
Posts: 175
Joined: Apr 24, 2011 12:57
Location: France

Re: FBGUI library for windows 2

Postby enform » Feb 20, 2019 15:18

Downloaded ! Thank you for your patience !
I use currently Lubuntu in Virtualbox but just for Firefox , not for prog ... but ...
Coolman
Posts: 208
Joined: Nov 05, 2010 15:09

Re: FBGUI library for windows 2

Postby Coolman » Mar 09, 2019 17:43

it seems that installing gtk2 and gtk3 is a bad idea. some libraries conflict... for example the compilation of IUP_FB_EDITOR has been successful but the program does not run with an error message:

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

for some examples of win9linux. the compilation was successful but nothing is displayed on screen. you should choose between gtk2 or gtk3. this library is really very heavy with many dependencies. i tested in a lxd container. i don't think i'll install this library in my system. distribute a program with gtk risk of being very restrictive under linux. this is my opinion. good continuation...
VANYA
Posts: 1323
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Postby VANYA » Mar 10, 2019 3:46

Coolman wrote:it seems that installing gtk2 and gtk3 is a bad idea. some libraries conflict... for example the compilation of IUP_FB_EDITOR has been successful but the program does not run with an error message:

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported


I don’t know why you get this error when using IUP.
I have the libgtk2.0-dev, libgtk-3-dev packages installed at the same time and there are no errors. Please try compiling IUP_FB_EDITOR with flag -v "verbose" and copy the compiler output for me.

--------------------------
For window9, there should be no such problems, because in the window9.bi file at the very top there is a macro with which you install the GTK graphics subsystem:

for GTK2 (comment):

'#define __USE_GTK3__

for GTK3 (uncomment):

#define __USE_GTK3__

Having decided on the choice of the gtk subsystem, you must compile the library with this subsystem gtk.
Coolman
Posts: 208
Joined: Nov 05, 2010 15:09

Re: FBGUI library for windows 2

Postby Coolman » Mar 10, 2019 18:56

this is the question I asked myself. what does iup have to do with gtk. to check I have uninstalled gtk2 and gtk3 and I got an error message when linking in connection with gtk-x11-2.0 and gdk-x11-2.0...

Code: Select all

FreeBASIC Compiler - Version 1.06.0 (03-06-2019), built for linux-x86_64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
target:       linux-x86_64, x86-64, 64bit
compiling:    fbnp.bas -o fbnp.c (main module)
compiling C:  gcc -m64 -march=x86-64 -S -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-main -Werror-implicit-function-declaration -O0 -fno-strict-aliasing -frounding-math -fno-math-errno -fwrapv -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -masm=intel "fbnp.c" -o "fbnp.asm"
assembling:   as --64 --strip-local-absolute "fbnp.asm" -o "fbnp.o"
linking:      ld -m elf_x86_64 -o "fbnp" -dynamic-linker /lib64/ld-linux-x86-64.so.2 "/usr/local/bin/../lib/freebasic/linux-x86_64/fbextra.x" -s -L "/usr/local/bin/../lib/freebasic/linux-x86_64" -L "." -L "/usr/lib/gcc/x86_64-linux-gnu/7" "/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crt1.o" "/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o" "/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o" "/usr/local/bin/../lib/freebasic/linux-x86_64/fbrt0.o" "fbnp.o" "-(" -liup -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangox-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -liup_scintilla -lfbmt -ltinfo -lm -ldl -lpthread -lgcc -lgcc_eh -lc "-)" "/usr/lib/gcc/x86_64-linux-gnu/7/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o"
ld: cannot find -lgtk-x11-2.0
ld: cannot find -lgdk-x11-2.0
linking failed: 'ld' terminated with exit code 1
VANYA
Posts: 1323
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Postby VANYA » Mar 11, 2019 2:54

I requested the compiler output when you get this error:

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported


In any case, such an error can occur only if you mix libraries intended for GTK2 with libraries intended for GTK3 in one project.
Coolman
Posts: 208
Joined: Nov 05, 2010 15:09

Re: FBGUI library for windows 2

Postby Coolman » Mar 11, 2019 14:14

yes. there must be a gtk3 lib that is integrated when linking. but I don't see which one. i'll see later if i have time. i tested some examples found in the forum about win9linux. it works if it's simple. i still think fltk would be a better choice. perfectly suited to freebasic to generate light programs without dependencies with a static compilation. otherwise iup is equally excellent. but it's your job. your choice.
enform
Posts: 175
Joined: Apr 24, 2011 12:57
Location: France

FBGUI 2 : About events

Postby enform » Mar 27, 2019 18:44

Hello,

My questions are about events in the usual Do Loop in window9.bi .

With this test of EventMouseWheel , the behaviour changes before 1 click or 2 on the editor
or after the click : before we get the normal event EventMouseWheel but after ... nothing .
What happens ?

After a click on the editor , turning on the mousewheel just a bit , one step , we get
20 or 30 events ... and this is a lot if the treatment we want to do is heavy ... for ex syntax highlighting ...

Also, 1 click on the VScrollbar gives 2 events .

It is frequent that windows sends the same msg many times ... and it is 'sometimes' annnoying .

A test with PeekMessage (.... , PM_REMOVE) does nothing here , but it's surely me ....

The most part of the time or all the time ... i do not take that in count but it is not optimal .

If you have the answers , don't hesitate to comment , I'll thank you ! ;-)

The code below is a modified code from the w9.chm

Greetings


Code: Select all

#Include "window9.bi"
#Define ld __LINE__

Dim As integer event,MouseWheel,EventEditor
Dim As String buf
Var hwnd = OpenWindow ("1",10,10,500,400)
EditorGadget (1,10,10,300,300, "")
TextGadget (2,350,20,100,20, "Scroll")

For a As Integer = 1 To 500
   buf + = "String ?  " & a & Chr (10)
Next

SetGadgetText (1, buf)

'/'
Do
   event = WaitEvent ()
   If IsMouseOver(hwnd) And (event = 522 Or event = 1025) Then ' filter
   ' EventMouseWheel   522 disappears after 1 or 2 clicks on the editor
      ?
      ? ld,"eventA",event,EventWParam,EventLParam
      ? ld,"eventB",LoWord(EventWParam),HiWord(EventWParam)
      ? ld,"eventC",LoWord(EventLParam),HiWord(EventLParam)
   EndIf    
   Select Case event
      Case EventClose
         Exit Do
      Case EventMouseWheel  ' 522
         If EventKEY < 0 Then
            MouseWheel += 1
            SetGadgetText (2, Str (MouseWheel))
            ? ld,"wheel down",EventMouseWheel,MouseWheel
         Else
            MouseWheel -= 1
            SetGadgetText (2, Str (MouseWheel))
            ? ld,"wheel up",EventMouseWheel,MouseWheel
         EndIf   
      Case EventGadget  ' 1025  many events for a minimal movement of the mousewheel
         If EventNumber = 1 Then
            EventEditor += 1
            ? ld,"editor",EventGadget,EventEditor
         ElseIf EventNumber = 2 Then
            LineScrollEditor (1,5)
            MouseWheel = 0
            EventEditor = 0
         EndIf
   End Select
Loop

VANYA
Posts: 1323
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Postby VANYA » Mar 28, 2019 16:29

With this test of EventMouseWheel , the behaviour changes before 1 click or 2 on the editor
or after the click : before we get the normal event EventMouseWheel but after ... nothing .
What happens ?


When you click in the RICHEDIT editor (editorgadget), it captures the focus, so the EventMouseWheel messages no longer come to the main window. TextGadget does not capture focus. Try changing the textgadget to buttongadget, click on the button and you will see that the button captures the focus and the EventMouseWheel message will be processed again.

After a click on the editor , turning on the mousewheel just a bit , one step , we get
20 or 30 events ... and this is a lot if the treatment we want to do is heavy ... for ex syntax highlighting ...


Yes, exactly, there is such a nuisance, but I can’t do anything, it’s a little implementation curve RICHEDIT from microsoft. Below in the example you will see that this happens regardless of window9:

Code: Select all

#INCLUDE "windows.bi"
LoadLibrary "RICHED20.DLL"
Dim msg As MSG
Dim As WNDCLASSEX wc
Dim As String NameClass="MyClass"
Dim As HINSTANCE Hinst=GetModuleHandle(0)
Dim Shared As Integer iCount

Function wndproc(hwnd As HWND, msg As Uinteger,_
    wparam As WPARAM, lparam As LPARAM) As Integer
    Select Case msg
        Case WM_DESTROY
            PostQuitMessage(0)
        Case WM_CREATE
            CreateWindowEx(WS_EX_CLIENTEDGE, "RICHEDIT20A", "RichEdit Control",_
            WS_VISIBLE Or WS_CHILD Or WS_HSCROLL Or WS_VSCROLL  Or ES_MULTILINE Or ES_AUTOHSCROLL Or ES_AUTOVSCROLL,_
            10,10,200,200, hwnd, Cast(HMENU,1), 0, 0)
       Case WM_COMMAND
          iCount+=1
          ? iCount
    End Select
    Return DefWindowProc(hwnd,msg,wparam,lparam)
End Function

With wc
    .cbSize=SizeOf(WNDCLASSEX)
    .style=CS_HREDRAW Or CS_VREDRAW
    .lpfnWndProc=@wndproc
    .hInstance=Hinst
    .hIcon=LoadIcon(0,IDI_WINLOGO)
    .hCursor=LoadCursor(0,IDC_ARROW)
    .hbrBackground=Cast(HBRUSH,COLOR_WINDOWFRAME)
    .lpszClassName=StrPtr(NameClass)
    .hIconSm=.hIcon
End With

If RegisterClassEx(@wc)=0 Then
    Print "Register error, press any key"
    Sleep
    End
Endif

CreateWindowEx(0,NameClass,"RichEdit",_
WS_VISIBLE Or WS_OVERLAPPEDWINDOW,100,100,240,260,0,0,Hinst,0)

While GetMessage(@msg,0,0,0)
    TranslateMessage(@msg)
    DispatchMessage(@msg)
Wend


And now we change the class of the editor with "RICHEDIT20A" on the "EDIT". As you can see, there is already no such problem, but "EDIT" does not have extended functionality like "RICHEDIT20A"

Code: Select all

#INCLUDE "windows.bi"
Dim msg As MSG
Dim As WNDCLASSEX wc
Dim As String NameClass="MyClass"
Dim As HINSTANCE Hinst=GetModuleHandle(0)
Dim Shared As Integer iCount

Function wndproc(hwnd As HWND, msg As Uinteger,_
    wparam As WPARAM, lparam As LPARAM) As Integer
    Select Case msg
        Case WM_DESTROY
            PostQuitMessage(0)
        Case WM_CREATE
            CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "Edit Control",_
            WS_VISIBLE Or WS_CHILD Or WS_HSCROLL Or WS_VSCROLL  Or ES_MULTILINE Or ES_AUTOHSCROLL Or ES_AUTOVSCROLL,_
            10,10,200,200, hwnd, Cast(HMENU,1), 0, 0)
       Case WM_COMMAND
          iCount+=1
          ? iCount
    End Select
    Return DefWindowProc(hwnd,msg,wparam,lparam)
End Function

With wc
    .cbSize=SizeOf(WNDCLASSEX)
    .style=CS_HREDRAW Or CS_VREDRAW
    .lpfnWndProc=@wndproc
    .hInstance=Hinst
    .hIcon=LoadIcon(0,IDI_WINLOGO)
    .hCursor=LoadCursor(0,IDC_ARROW)
    .hbrBackground=Cast(HBRUSH,COLOR_WINDOWFRAME)
    .lpszClassName=StrPtr(NameClass)
    .hIconSm=.hIcon
End With

If RegisterClassEx(@wc)=0 Then
    Print "Register error, press any key"
    Sleep
    End
Endif

CreateWindowEx(0,NameClass,"Edit",_
WS_VISIBLE Or WS_OVERLAPPEDWINDOW,100,100,240,260,0,0,Hinst,0)

While GetMessage(@msg,0,0,0)
    TranslateMessage(@msg)
    DispatchMessage(@msg)
Wend



P.S. It seems to me when RICHEDIT was created, the microsoft company was in a hurry somewhere, because this control was not thought out.
enform
Posts: 175
Joined: Apr 24, 2011 12:57
Location: France

Re: FBGUI library for windows 2

Postby enform » Mar 28, 2019 21:47

I made tests with other Gadgets , I see the differences .
Adding SetCapture(hwnd) somewhere and after our task is finished re-valid the EventMouseWheel .

Maybe later I'll have a look at Scintilla , but it's another task ...

For the repeated events , no possibilities with PeekMessage(.......,PM_REMOVE) ?
I have used an event filter with some If NewEvent <> OldEvent Then do the task ; OldEvent = NewEvent

Thank you , dear teacher , have fun

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 11 guests