Page 1 of 1

Disable VIRTUAL HEIGHT or VIRTUAL WIDTH

Posted: Sat Mar 01, 2014 12:01 am
by danielmaximiliano
El amigo Luis Eduardo me pregunto si se podia desabilitar el desplazamiento vertical en una ventana conteniendo VirtualDim.
mirando primeramente el Source de Window me encontre con esto
C:\hmg.3.2\SAMPLES\Controls\VirtualDim\VIRTUALDIM.5\demo.prg
Translate Google
The friend Luis Eduardo asked me if I could disable vertical scrolling in a window containing VirtualDim.
Source of watching the first I came across this Window[/color]

Code: Select all

if valtype(VirtualHeight) == "U"
		VirtualHeight	:= 0
		vscroll		:= .f.
	Else
		If VirtualHeight <= h
			MsgHMGError("DEFINE WINDOW: Virtual Height Must Be Greater Than Height. Program Terminated" )
		EndIf

		vscroll		:= .t.

	endif

nos encontramos que si indicamos "Virtual Height" el mismo no tiene definicion por lo cual asume
we found that if we indicate "Virtual Height" has the same definition thus assumes

Code: Select all

vscroll		:= .f.
Reemplazando / replacing

Code: Select all

DEFINE WINDOW Form_Main ;
		AT 0,0 ;
		WIDTH 640 ;
		HEIGHT 480 ;
		VIRTUAL WIDTH 1300 ;
      VIRTUAL HEIGHT  800;
		TITLE 'Virtual Dimensioned Window Demo' ;
		MAIN 
Por / By

Code: Select all

DEFINE WINDOW Form_Main ;
		AT 0,0 ;
		WIDTH 640 ;
		HEIGHT 480 ;
		VIRTUAL WIDTH 1300 ;
		TITLE 'Virtual Dimensioned Window Demo' ;
		MAIN 
desabilitamos el desplazamiento Vertical y solo tenemos desplazamiento Horizontal, lo que necesita nuestro amigo Eduardo Luis
we disable the Vertical Scroll and Horizontal Scroll just have, you need our friend Luis Eduardo
virtual.jpg
virtual.jpg (21.22 KiB) Viewed 3882 times
Enjoy

Re: Disable VIRTUAL HEIGHT or VIRTUAL WIDTH

Posted: Sat Mar 01, 2014 12:23 am
by Javier Tovar
Hola DanielMaximiliano,

Gracias por compartir :D

Saludos

P.D.: No lo sabia!

Re: Disable VIRTUAL HEIGHT or VIRTUAL WIDTH

Posted: Sat Mar 01, 2014 7:27 pm
by andyglezl
Gracias Maximiliano !!!

Y para complementar esto, sabes como activamos la rueda de Scroll para
que avance horizontalme ?
----------------------------------------------------------------------
Maximiliano Thanks!

And to complement this, know how to activate the scroll wheel to
horizontalme advance?

Re: Disable VIRTUAL HEIGHT or VIRTUAL WIDTH

Posted: Sat Mar 01, 2014 7:54 pm
by andyglezl
Con el codigo siguiente (gracias Dr.Soto), funcionan las teclas PgUp y PgDow para avanzar o retroceder
(en forma vertical) y funciona tambien la rueda de Scroll.
---------------------------------------------------------------------------
With the following code (thanks Dr.Soto), run the PgUp and PgDow keys to move forward or backward
(vertically) and also works Scroll wheel.

Code: Select all

*//--------------Para avanzar con PgUp y PgDow -------------------------------------------------------------------
				hWnd := GetFormHandle("Form_Main")  ;  NewStep :=  250
				ON KEY PRIOR OF Form_Main ACTION {|| SetScrollPos (hWnd, SB_VERT, GetScrollPos(hWnd, SB_VERT) - NewStep -20, .T.), ;
								SendMessage (hWnd, WM_VSCROLL , SB_PAGEUP,    0 )}
				ON KEY NEXT  OF Form_Main ACTION {|| SetScrollPos (hWnd, SB_VERT, GetScrollPos(hWnd, SB_VERT) + NewStep -20, .T.), ;
								SendMessage (hWnd, WM_VSCROLL , SB_PAGEDOWN , 0 )}
//---------------------------------------------------------------------------------------------------------------
Tendriamos que poner una constante "SB_HORIZ" pero con que valor ?
y como le indicamos al "Scroll whell" que sea en forma horizontal ?

Dr. Soto, alguna idea ?
----------------------------------------------------------------------
We'd have to add a constant "SB_HORIZ" but with that value?
and as we tell the "Scroll whell" it horizontally?

Dr. Soto, any ideas?

Re: Disable VIRTUAL HEIGHT or VIRTUAL WIDTH

Posted: Thu Mar 27, 2014 9:37 pm
by srvet_claudio
andyglezl wrote:Con el codigo siguiente (gracias Dr.Soto), funcionan las teclas PgUp y PgDow para avanzar o retroceder
(en forma vertical) y funciona tambien la rueda de Scroll.
---------------------------------------------------------------------------
With the following code (thanks Dr.Soto), run the PgUp and PgDow keys to move forward or backward
(vertically) and also works Scroll wheel.

Code: Select all

*//--------------Para avanzar con PgUp y PgDow -------------------------------------------------------------------
				hWnd := GetFormHandle("Form_Main")  ;  NewStep :=  250
				ON KEY PRIOR OF Form_Main ACTION {|| SetScrollPos (hWnd, SB_VERT, GetScrollPos(hWnd, SB_VERT) - NewStep -20, .T.), ;
								SendMessage (hWnd, WM_VSCROLL , SB_PAGEUP,    0 )}
				ON KEY NEXT  OF Form_Main ACTION {|| SetScrollPos (hWnd, SB_VERT, GetScrollPos(hWnd, SB_VERT) + NewStep -20, .T.), ;
								SendMessage (hWnd, WM_VSCROLL , SB_PAGEDOWN , 0 )}
//---------------------------------------------------------------------------------------------------------------
Tendriamos que poner una constante "SB_HORIZ" pero con que valor ?
y como le indicamos al "Scroll whell" que sea en forma horizontal ?

Dr. Soto, alguna idea ?
----------------------------------------------------------------------
We'd have to add a constant "SB_HORIZ" but with that value?
and as we tell the "Scroll whell" it horizontally?

Dr. Soto, any ideas?
Andrés:
#define WM_HSCROLL 276
#define SB_HORZ 0
En el código anterior donde aparece +20 y -20 cambia por:
+_HMG_SYSDATA[ 501 ] y - _HMG_SYSDATA [ 501 ] respectivamente.

Re: Disable VIRTUAL HEIGHT or VIRTUAL WIDTH

Posted: Thu Mar 27, 2014 10:46 pm
by danielmaximiliano
srvet_claudio wrote:
Andrés:
#define WM_HSCROLL 276
#define SB_HORZ 0
En el código anterior donde aparece +20 y -20 cambia por:
+_HMG_SYSDATA[ 501 ] y - _HMG_SYSDATA [ 501 ] respectivamente.
Gracias por el TIP Claudio.....

Re: Disable VIRTUAL HEIGHT or VIRTUAL WIDTH

Posted: Tue Mar 28, 2017 2:29 am
by Pablo César
I also want to share this experience with VIRTUAL WIDTH / HEIGHT.

You can define your window like this:

Code: Select all

#include <hmg.ch>

Function Main ()
DEFINE WINDOW Demo1 AT 259, 683 WIDTH 550 HEIGHT 350;
        VIRTUAL WIDTH 1100 TITLE "Virtual Width / Height Demo" MAIN

END WINDOW
Demo1.Center
Demo1.Activate
Return Nil
 
You will not have any problems while compiling.

It will also not give compilation problems if you switch from:
VIRTUAL WIDTH 1100 VIRTUAL HEIGHT NIL TITLE "Virtual Width / Height Demo" MAIN
Per:
VIRTUAL WIDTH Nil VIRTUAL HEIGHT 700 TITLE "Virtual Width / Height Demo" MAIN

But if you do the IDE, until the current version (1.2a) will give error. This has been reported ( here ).