Disable VIRTUAL HEIGHT or VIRTUAL WIDTH

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
User avatar
danielmaximiliano
Posts: 2106
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 132 times
Been thanked: 16 times
Contact:

Disable VIRTUAL HEIGHT or VIRTUAL WIDTH

Post by danielmaximiliano » Sat Mar 01, 2014 12:01 am

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 1812 times
Enjoy
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar » Sat Mar 01, 2014 12:23 am

Hola DanielMaximiliano,

Gracias por compartir :D

Saludos

P.D.: No lo sabia!

User avatar
andyglezl
Posts: 1144
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 35 times
Been thanked: 68 times
Contact:

Post by andyglezl » Sat Mar 01, 2014 7:27 pm

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?
Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
andyglezl
Posts: 1144
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 35 times
Been thanked: 68 times
Contact:

Post by andyglezl » Sat Mar 01, 2014 7:54 pm

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 González López
Desde Guadalajara, Jalisco. México.

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Thu Mar 27, 2014 9:37 pm

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.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
danielmaximiliano
Posts: 2106
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 132 times
Been thanked: 16 times
Contact:

Post by danielmaximiliano » Thu Mar 27, 2014 10:46 pm

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.....
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Tue Mar 28, 2017 2:29 am

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 ).
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Post Reply