RICHEDITBOX in Panel-Window (Virtual Height)

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

edk
Posts: 912
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: RICHEDITBOX in Panel-Window (Virtual Height)

Post by edk »

Hi Karl.
I think that another solution is cleaning mouse state (unpress mouse left key) before vscroll:

Code: Select all

FUNCTION changekey ()
ON KEY TAB OF Form_3 ACTION HMG_PRESSKEY(17, 9)
ON KEY ESCAPE OF Form_3 ACTION Form_3.Text_2.SETFOCUS
HMG_CleanLastMouseMessage()
Millisec(100)
_HMG_PRINTER_SETVSCROLLVALUE(GetFormHandle('Form_3'), 350)
RETURN Nil
Karl
Posts: 39
Joined: Tue Mar 14, 2017 12:24 pm
DBs Used: DBF

Re: RICHEDITBOX in Panel-Window (Virtual Height)

Post by Karl »

Edward, both versions do the same, but the millisecs are critical. If I enter the RichEditBox from a TextBox before, with 5 millisec it always works well. But if I enter the RichEditBox from a following TextBox, I need 100 millisec (HMG_CleanLastMouseMessage()) or 30 millisec (UnSelectAll). If I shorten this time, it marks text. :D
Karl
WIN 10 64-bit, WIN 7 32-bit, HMG 3.4.4, 32-bit
edk
Posts: 912
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: RICHEDITBOX in Panel-Window (Virtual Height)

Post by edk »

Indeed, this is due to the fact that Autoscroll (in fact _HMG_PRINTER_SETVSCROLLVALUE) emulates a shift bar slider, which in conjunction with the mouse click selects the text. If you hold down the left mouse button longer than the milisec declared, then the text will be selected. :(

You can try disabling Autoscroll and controlling the mouse state when RichBoxEdit get focus, but it requires defining for each control to move the vertical bar slider.

You have an example in the attachment.

In this function the mouse status is checked and if the left mouse button is pressed it does not exit the loop, but you just hold down the left mouse button and move the pointer to change the state to WM_MOUSEMOVE and the text selection again.
I have no idea why when RichEditBox getting focus, mouse status does not return WM_LBUTTONUP when releasing the left mouse buton. Instead WM_LBUTTONUP is WM_MOUSEMOVE. :?
Attachments
RichEditBox_2.7z
(1.09 MiB) Downloaded 180 times
Karl
Posts: 39
Joined: Tue Mar 14, 2017 12:24 pm
DBs Used: DBF

Re: RICHEDITBOX in Panel-Window (Virtual Height)

Post by Karl »

Yes, now as you say it, I`ve also noticed it. The solution will be for the user a bit more flicker of the RichEditBox because of more millisecs. In my app there are 22 TextBoxes/Buttons before the RichEditBox and 7 after it. Therefore I cannot do without "Set AutoScroll On". Maybe there is a routine which set it to "Off" when any of these controls lose focus and before the RichEditBox gains focus. But this exceeds my knowledge. ;) Any idea? :)
TIA Karl
WIN 10 64-bit, WIN 7 32-bit, HMG 3.4.4, 32-bit
Karl
Posts: 39
Joined: Tue Mar 14, 2017 12:24 pm
DBs Used: DBF

Re: RICHEDITBOX in Panel-Window (Virtual Height)

Post by Karl »

Therefore I cannot do without "Set AutoScroll On".
Hi Edward, I set "AutoScroll Off" and found out, that it is the same behavior. When I click into the RichEditBox with the mouse, it selects text. So it has nothing to do with AutoScroll. I am glad, that at least your two solutions remain.
WIN 10 64-bit, WIN 7 32-bit, HMG 3.4.4, 32-bit
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: RICHEDITBOX in Panel-Window (Virtual Height)

Post by andyglezl »

Hola Karl

Hice algunos cambios, quizá puedan ayudar...
----------------------------------------------------------
Hello Karl

I made some changes, maybe they can help ...


Code: Select all

*******************************************************************************
* program "ModWin" = Create a Modal-Window
* started at: 02.06.2017
* changed at: 
********************************************************************************
#include <hmg.ch>

*SET NAVIGATION EXTENDED

DEFINE WINDOW Form_2 ;
    AT 0,0 ;
    WIDTH 842 ;
    HEIGHT 616 ;
    TITLE 'This is a Modal-Window' ;
    MODAL ;
    NOSIZE ;
    NOSYSMENU ;
    BACKCOLOR {198,252,188}
    
DEFINE TOOLBAR toolbar_1 OF Form_2 BUTTONSIZE 280,33 FONT "Arial" SIZE 10 ;
                RIGHTTEXT BORDER
    BUTTON button_1 CAPTION 'Close Window' ACTION Form_2.RELEASE
END TOOLBAR

DEFINE STATUSBAR OF Form_2 FONT "Arial" SIZE 9
    STATUSITEM ""
END STATUSBAR

@  60,220 Label label_1 OF Form_80 ;
          VALUE "Commission-Number" ;
          HEIGHT 20 ;
          WIDTH 150 ;
          FONT 'Arial' SIZE 12 ;
          BACKCOLOR {198,252,188}          

@  60,385 TEXTBOX Text_1 OF Form_80 ;
          HEIGHT 20 ;
          WIDTH 90 ;
          FONT 'Arial' SIZE 12 ;
          VALUE '' ;
          ON ENTER Formular()

END WINDOW
CENTER WINDOW Form_2
ACTIVATE WINDOW Form_2
RETURN
*****************************   End Window Form_2   ****************************

***********************   Begin Window Form_3   ********************************
PROCEDURE Formular()

DEFINE WINDOW Form_3 ;
AT 0,10 ;
WIDTH 816 ;
HEIGHT 560 ;
VIRTUAL HEIGHT 1152 ;
MODAL ;
NOSIZE ;
NOCAPTION ;
NOSYSMENU ;
BACKCOLOR {183,183,255} ;
ON MOUSECLICK Form_3.Setfocus          

@ 10,30   BUTTON Button_1 OF Form_3 ;
          CAPTION 'Close Window' ;
          ON CLICK Form_3.RELEASE ;
          WIDTH 120 ;
          HEIGHT 30 ;
          FONT 'Arial' SIZE 12 ;
          MULTILINE

@ 100,220 LABEL Label_1 OF Form_3 ;
          VALUE 'Label_1' ;
          HEIGHT 25 ;
          WIDTH 80 ;
          FONT 'Arial' SIZE 12 ;
          BACKCOLOR {183,183,255}
          
@ 100,330 TEXTBOX Text_1 OF Form_3 ;
          VALUE 'Text_1' ;
          HEIGHT 25 ;
          WIDTH 80 ;
          FONT 'Arial' SIZE 12

@ 130,220 LABEL Label_2 OF Form_3 ;
          VALUE 'Button_2' ;
          HEIGHT 25 ;
          WIDTH 90 ;
          FONT 'Arial' SIZE 12 ;
          BACKCOLOR {183,183,255}          
          
@ 130,330 BUTTON Button_2 OF Form_3 ;
          CAPTION 'Button_2' ;
          ON CLICK '' ;
          WIDTH 90 ;
          HEIGHT 30 ;
          FONT 'Arial' SIZE 12 ;
          ON GOTFOCUS nil ;
          MULTILINE
          
   
@ 250,72  RICHEDITBOX Edit_1 OF Form_3 ;
          WIDTH 695 ;
          HEIGHT 460 ;
          VALUE '' ;
          FONT 'Times New Roman' SIZE 12 ;
          ON GOTFOCUS (	Form_3.Edit_1.Setfocus, Form_3.Edit_1.UnSelectAll, Form_3.Edit_1.CaretPos := 1 ) ;
          NOHSCROLL
	  
@ 860,220 LABEL Label_3 OF Form_3 ;
          VALUE 'Label_3' ;
          HEIGHT 25 ;
          WIDTH 80 ;
          FONT 'Arial' SIZE 12 ;
          BACKCOLOR {183,183,255}          

@ 860,330 TEXTBOX Text_2 OF Form_3 ;
          VALUE 'Text_3' ;
          HEIGHT 25 ;
          WIDTH 80 ;
          FONT 'Arial' SIZE 12
          
@1040,220 LABEL Label_4 OF Form_3 ;
          VALUE 'Label_4' ;
          HEIGHT 25 ;
          WIDTH 80 ;
          FONT 'Arial' SIZE 12 ;
          BACKCOLOR {183,183,255}          

@1040,330 TEXTBOX Text_3 OF Form_3 ;
          VALUE 'Text_4' ;
          HEIGHT 25 ;
          WIDTH 80 ;
          FONT 'Arial' SIZE 12
          
Form_3.Edit_1.RTFLoadFile('10550.rtf', .F.)
END WINDOW
CENTER WINDOW Form_3
ACTIVATE WINDOW Form_3
RETURN NIL
Andrés González López
Desde Guadalajara, Jalisco. México.
Karl
Posts: 39
Joined: Tue Mar 14, 2017 12:24 pm
DBs Used: DBF

Re: RICHEDITBOX in Panel-Window (Virtual Height)

Post by Karl »

andyglezl wrote: Thu Jun 08, 2017 5:07 am I made some changes, maybe they can help ...
Hello Andy,
thank you for your interest in my problem. I tested your changes. You are right, when I come from the textboxes/buttons before the RichEditBox and enter it, shows me the whole Box and I am at the beginning. But if I do the same with a mouseclick, text will be selected. When I enter the RichEditBox from a TextBox after it, text will not be selected but it doesn´t show the whole box.
Regards Karl
WIN 10 64-bit, WIN 7 32-bit, HMG 3.4.4, 32-bit
Post Reply