Author | Topic: Graphic out put to screen | |
---|---|---|
Jari Sollo | Graphic out put to screen on Wed, 29 Jan 2014 12:23:37 +0200 Hi ! I understood that writing text to screen sould be quite simple, apparentlynot to me. Iwrote small program and did not manage even with it. Could somebody please tell me what is wrong/missing? Here is simple code: #include "Gra.ch" #include "Xbp.ch" #include "Appevent.ch" #include "Font.ch" #PRAGMA LIBRARY( "ASCOM10.LIB" ) PROCEDURE AppSys RETURN //--------------------------------------- AppSys -------------------------------------------------------------- PROCEDURE Main LOCAL nEvent, mp1, mp2, aSize, oPS, aPS, oScreen LOCAL oDlg, oXbp, drawingArea, aEditControls := {} oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) oDlg:taskList := .T. oDlg:title := "Test window" oDlg:create() aPS := {800,600} oScreen := oDlg:windevice() drawingArea := oDlg:drawingArea drawingArea:setFontCompoundName( "8.Arial" ) oPS := XbpPresSpace():new() oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) oDlg:show() SetAppFocus(oDlg) GraStringAt(oPS, {400,200}, "Testing...") oPS:configure() nEvent := xbe_None WHILE nEvent <> xbeP_Close nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) END RETURN //------------------------------------ main ------------------------------------- | |
Carlos A Beling | Re: Graphic out put to screen on Wed, 29 Jan 2014 10:17:36 -0200 Hello Jari. Good morning. I could not to see you setting the font and other attributes that I think that they may be needed. Please see GraSetAtrStr(). Beling Best regards Em 29/1/2014 08:23, Jari Sollo escreveu: > Hi ! > I understood that writing text to screen sould be quite simple, > apparentlynot to me. Iwrote small program and did not manage even with > it. Could somebody please tell me what is wrong/missing? > > Here is simple code: > > #include "Gra.ch" > #include "Xbp.ch" > #include "Appevent.ch" > #include "Font.ch" > #PRAGMA LIBRARY( "ASCOM10.LIB" ) > > PROCEDURE AppSys > RETURN //--------------------------------------- AppSys > -------------------------------------------------------------- > > PROCEDURE Main > LOCAL nEvent, mp1, mp2, aSize, oPS, aPS, oScreen > LOCAL oDlg, oXbp, drawingArea, aEditControls := {} > > > > oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) > oDlg:taskList := .T. > oDlg:title := "Test window" > oDlg:create() > aPS := {800,600} > oScreen := oDlg:windevice() > drawingArea := oDlg:drawingArea > drawingArea:setFontCompoundName( "8.Arial" ) > oPS := XbpPresSpace():new() > oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) > oDlg:show() > SetAppFocus(oDlg) > GraStringAt(oPS, {400,200}, "Testing...") > oPS:configure() > > nEvent := xbe_None > WHILE nEvent <> xbeP_Close > nEvent := AppEvent( @mp1, @mp2, @oXbp ) > oXbp:handleEvent( nEvent, mp1, mp2 ) > END > RETURN //------------------------------------ main > ------------------------------------- > | |
Jari Sollo | Re: Graphic out put to screen on Wed, 29 Jan 2014 16:19:51 +0200 same result/no reffect... Did you mean like this: #include "Gra.ch" #include "Xbp.ch" #include "Appevent.ch" #include "Font.ch" #PRAGMA LIBRARY( "ASCOM10.LIB" ) PROCEDURE AppSys RETURN //--------------------------------------- AppSys -------------------------------------------------------------- PROCEDURE Main LOCAL nEvent, mp1, mp2, aSize, oPS, aPS, oScreen, oFont, aAttr, aOldAttr LOCAL oDlg, oXbp, drawingArea, aEditControls := {} aAttr := aAttr := ARRAY( GRA_AS_COUNT ) aAttr [ GRA_AS_COLOR ] := GRA_CLR_RED aAttr [ GRA_AS_BACKCOLOR ] := GRA_CLR_BLUE aAttr [ GRA_AS_MIXMODE ] := GRA_FGMIX_OVERPAINT aAttr [ GRA_AS_BGMIXMODE ] := GRA_BGMIX_OVERPAINT oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) oDlg:taskList := .T. oDlg:title := "Test window" oDlg:create() aPS := {800,600} oScreen := oDlg:windevice() drawingArea := oDlg:drawingArea drawingArea:setFontCompoundName( "8.Arial" ) oPS := XbpPresSpace():new() oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) oFont := xbpFont():new(oPS) oFont:familyName := "Arial" oFont:nominalPointSize := 14 oFont:create() oPS:setFont(oFont) aOldAttr := GraSetAttrString( oPS, aAttr ) oDlg:show() SetAppFocus(oDlg) GraStringAt(oPS, {400,200}, "Testing...") oPS:configure() nEvent := xbe_None WHILE nEvent <> xbeP_Close nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) END RETURN //------------------------------------ main ------------------------------------- "Carlos A Beling" kirjoitti viestissä:1645e129$74c8d117$3441@news.alaska-software.com... Hello Jari. Good morning. I could not to see you setting the font and other attributes that I think that they may be needed. Please see GraSetAtrStr(). Beling Best regards Em 29/1/2014 08:23, Jari Sollo escreveu: > Hi ! > I understood that writing text to screen sould be quite simple, > apparentlynot to me. Iwrote small program and did not manage even with > it. Could somebody please tell me what is wrong/missing? > > Here is simple code: > > #include "Gra.ch" > #include "Xbp.ch" > #include "Appevent.ch" > #include "Font.ch" > #PRAGMA LIBRARY( "ASCOM10.LIB" ) > > PROCEDURE AppSys > RETURN //--------------------------------------- AppSys > -------------------------------------------------------------- > > PROCEDURE Main > LOCAL nEvent, mp1, mp2, aSize, oPS, aPS, oScreen > LOCAL oDlg, oXbp, drawingArea, aEditControls := {} > > > > oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) > oDlg:taskList := .T. > oDlg:title := "Test window" > oDlg:create() > aPS := {800,600} > oScreen := oDlg:windevice() > drawingArea := oDlg:drawingArea > drawingArea:setFontCompoundName( "8.Arial" ) > oPS := XbpPresSpace():new() > oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) > oDlg:show() > SetAppFocus(oDlg) > GraStringAt(oPS, {400,200}, "Testing...") > oPS:configure() > > nEvent := xbe_None > WHILE nEvent <> xbeP_Close > nEvent := AppEvent( @mp1, @mp2, @oXbp ) > oXbp:handleEvent( nEvent, mp1, mp2 ) > END > RETURN //------------------------------------ main > ------------------------------------- > | |
Andreas Gehrs-Pahl | Re: Graphic out put to screen on Wed, 29 Jan 2014 13:22:26 -0500 Jari, >Could somebody please tell me what is wrong/missing? Your oScreen variable references the WinDevice of the Dialog, but should point to the WinDevice of the DrawingArea of the Dialog. The following small change will get your some output: oScreen := oDlg:DrawingArea:WinDevice() Hope that helps. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net Andreas.Gehrs-Pahl@InterAct911.com Andreas.Gehrs-Pahl@EJusticeSolutions.com Andreas@DDPSoftware.com web: http://www.Aerospace-History.net | |
Jari Sollo | Re: Graphic out put to screen on Fri, 31 Jan 2014 14:19:05 +0200 Thanks, Andeas. Still no effect. How difficult this could be!?! I have desperately tried almost everything and I might be even more far away from correct programming than at beginning: #include "Gra.ch" #include "Xbp.ch" #include "Appevent.ch" #include "Font.ch" #PRAGMA LIBRARY( "ASCOM10.LIB" ) PROCEDURE AppSys RETURN //------------------------------ AppSys ---------------------------------------------------- PROCEDURE Main Local nEvent, mp1, mp2, aSize, oPS, aPS, oScreen, oFont, aAttr, aOldAttr Local oDlg, oXbp, drawingArea, aEditControls := {}, nSegment, nY, oPart oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) oDlg:taskList := .T. oDlg:title := "Test window" oDlg:create() aPS := {800,600} drawingArea := oDlg:drawingArea drawingArea:setFontCompoundName( "8.Arial" ) oScreen := drawingArea:windevice() oPS := XbpPresSpace():new() oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) oFont := xbpFont():new(oPS) oFont:familyName := "Arial" oFont:nominalPointSize := 14 oFont:create() oDlg:show() oPS:setFont(oFont) oPS:setViewPort({0,0,800,600}) SetAppFocus(oDlg) GraSegDrawMode( oPS, GRA_DM_RETAIN ) nSegment := graSegOpen(oPS) nY := 630 WHILE nY > 0 GraStringAt(oPS, {400,nY}, "Testing...") nY -= 40 END graSegClose(oPS) GraSegDrawMode( oPS, GRA_DM_DRAWANDRETAIN ) oPS:configure() nEvent := xbe_None WHILE nEvent <> xbeP_Close nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) END RETURN //------------------------------------ main ------------------------------------- "Andreas Gehrs-Pahl" kirjoitti viestissä:zjmdrpbm6oao$.k3h6tst3z81h.dlg@40tude.net... Jari, >Could somebody please tell me what is wrong/missing? Your oScreen variable references the WinDevice of the Dialog, but should point to the WinDevice of the DrawingArea of the Dialog. The following small change will get your some output: oScreen := oDlg:DrawingArea:WinDevice() Hope that helps. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net Andreas.Gehrs-Pahl@InterAct911.com Andreas.Gehrs-Pahl@EJusticeSolutions.com Andreas@DDPSoftware.com web: http://www.Aerospace-History.net "Andreas Gehrs-Pahl" kirjoitti viestissä:zjmdrpbm6oao$.k3h6tst3z81h.dlg@40tude.net... Jari, >Could somebody please tell me what is wrong/missing? Your oScreen variable references the WinDevice of the Dialog, but should point to the WinDevice of the DrawingArea of the Dialog. The following small change will get your some output: oScreen := oDlg:DrawingArea:WinDevice() Hope that helps. Andreas -- Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net Andreas.Gehrs-Pahl@InterAct911.com Andreas.Gehrs-Pahl@EJusticeSolutions.com Andreas@DDPSoftware.com web: http://www.Aerospace-History.net | |
Carlos A Beling | Re: Graphic out put to screen on Fri, 31 Jan 2014 11:03:06 -0200 Hello Jari: good morning. Did you try: 1) to change GRA_PU_LOMETRIC by GRA_PU_PIXELS 2) to oPS:setPageSize(aPS, GRA_PU_PIXELS) 3) do not use GraSeg... functions 4) eliminate oPS:setViewPort() 5) eliminate the line oPS:configure() The function SetAppFocus() does not interfere in Gra... functions Note: GRA_PU_LOMETRIC specifies the mesaure in milimeters (one milimeter may contains many pixels) Beling HTH Em 31/1/2014 10:19, Jari Sollo escreveu: > Thanks, Andeas. > Still no effect. How difficult this could be!?! > I have desperately tried almost everything and I might be even more far > away from correct programming than at beginning: > > > #include "Gra.ch" > #include "Xbp.ch" > #include "Appevent.ch" > #include "Font.ch" > #PRAGMA LIBRARY( "ASCOM10.LIB" ) > > PROCEDURE AppSys > RETURN //------------------------------ AppSys > ---------------------------------------------------- > > PROCEDURE Main > Local nEvent, mp1, mp2, aSize, oPS, aPS, oScreen, oFont, aAttr, aOldAttr > Local oDlg, oXbp, drawingArea, aEditControls := {}, nSegment, nY, oPart > > oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) > oDlg:taskList := .T. > oDlg:title := "Test window" > oDlg:create() > aPS := {800,600} > drawingArea := oDlg:drawingArea > drawingArea:setFontCompoundName( "8.Arial" ) > > oScreen := drawingArea:windevice() > oPS := XbpPresSpace():new() > oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) > oFont := xbpFont():new(oPS) > oFont:familyName := "Arial" > oFont:nominalPointSize := 14 > oFont:create() > oDlg:show() > > oPS:setFont(oFont) > oPS:setViewPort({0,0,800,600}) > > SetAppFocus(oDlg) > GraSegDrawMode( oPS, GRA_DM_RETAIN ) > nSegment := graSegOpen(oPS) > nY := 630 > WHILE nY > 0 > GraStringAt(oPS, {400,nY}, "Testing...") > nY -= 40 > END > graSegClose(oPS) > GraSegDrawMode( oPS, GRA_DM_DRAWANDRETAIN ) > oPS:configure() > > nEvent := xbe_None > WHILE nEvent <> xbeP_Close > nEvent := AppEvent( @mp1, @mp2, @oXbp ) > oXbp:handleEvent( nEvent, mp1, mp2 ) > END > RETURN //------------------------------------ main > ------------------------------------- > > > > "Andreas Gehrs-Pahl" kirjoitti > viestissä:zjmdrpbm6oao$.k3h6tst3z81h.dlg@40tude.net... > > Jari, > >> Could somebody please tell me what is wrong/missing? > > Your oScreen variable references the WinDevice of the Dialog, but should > point to the WinDevice of the DrawingArea of the Dialog. The following > small change will get your some output: > > oScreen := oDlg:DrawingArea:WinDevice() > > Hope that helps. > > Andreas | |
Jose Antonio Diego Kereje | Re: Graphic out put to screen on Fri, 31 Jan 2014 14:10:44 +0100 Hi Jari, You can find several examples in the folder ...\ALASKA\XPPW32\source\samples\basics\GRA Alternatively, you can paint on a XbpStatic object using the Ownerdraw mode. Regards. Diego --- Este mensaje no contiene virus ni malware porque la protección de avast! Antivirus está activa. http://www.avast.com | |
Philip G Jackson | Re: Graphic out put to screen on Sat, 01 Feb 2014 09:28:34 +1300 Hi Jari I use the following so that I can write fast screens using GRA methods oPS := XbpPresSpace():New() oDevice := oDialog:DrawingArea:WinDevice() oPS:CREATE(oDevice) oPS:Mode := XBPPS_MODE_HIGH_PRECISION GraSetColor(oPS,GRA_CLR_WHITE) oFont := xbpfont():NEw(oPS):CREATE('10.Arial Bold') GraSetFont(oFont) display your text example GraStringAt(oPS, {nColumn, nLine}, cTextToPrint) ... oPS:Destroy() oFont:Destroy() I have two modes of drawing a small number of screens - objects and Gra commands. GRA is somewhere between 10 and 20 times faster without measuring it precisely. Hope that helps. Cheers Phil Jackson On 29/01/2014 11:23 p.m., Jari Sollo wrote: > Hi ! > I understood that writing text to screen sould be quite simple, > apparentlynot to me. Iwrote small program and did not manage even with > it. Could somebody please tell me what is wrong/missing? > > Here is simple code: > > #include "Gra.ch" > #include "Xbp.ch" > #include "Appevent.ch" > #include "Font.ch" > #PRAGMA LIBRARY( "ASCOM10.LIB" ) > > PROCEDURE AppSys > RETURN //--------------------------------------- AppSys > -------------------------------------------------------------- > > PROCEDURE Main > LOCAL nEvent, mp1, mp2, aSize, oPS, aPS, oScreen > LOCAL oDlg, oXbp, drawingArea, aEditControls := {} > > > > oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) > oDlg:taskList := .T. > oDlg:title := "Test window" > oDlg:create() > aPS := {800,600} > oScreen := oDlg:windevice() > drawingArea := oDlg:drawingArea > drawingArea:setFontCompoundName( "8.Arial" ) > oPS := XbpPresSpace():new() > oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) > oDlg:show() > SetAppFocus(oDlg) > GraStringAt(oPS, {400,200}, "Testing...") > oPS:configure() > > nEvent := xbe_None > WHILE nEvent <> xbeP_Close > nEvent := AppEvent( @mp1, @mp2, @oXbp ) > oXbp:handleEvent( nEvent, mp1, mp2 ) > END > RETURN //------------------------------------ main > ------------------------------------- > | |
Jari Sollo | Re: Graphic out put to screen on Mon, 03 Feb 2014 12:09:02 +0200 Thanks everybody for helping me to get the picture. The real missing points was: oScreen := drawingArea:windevice() and: oPS:configure(oScreen) with those lines it finally went ok. Is there a way to prevent graphic disappear while minimize and maximize window? "Philip G Jackson" kirjoitti viestissä:52074ca8$232a6434$4da@news.alaska-software.com... Hi Jari I use the following so that I can write fast screens using GRA methods oPS := XbpPresSpace():New() oDevice := oDialog:DrawingArea:WinDevice() oPS:CREATE(oDevice) oPS:Mode := XBPPS_MODE_HIGH_PRECISION GraSetColor(oPS,GRA_CLR_WHITE) oFont := xbpfont():NEw(oPS):CREATE('10.Arial Bold') GraSetFont(oFont) display your text example GraStringAt(oPS, {nColumn, nLine}, cTextToPrint) ... oPS:Destroy() oFont:Destroy() I have two modes of drawing a small number of screens - objects and Gra commands. GRA is somewhere between 10 and 20 times faster without measuring it precisely. Hope that helps. Cheers Phil Jackson On 29/01/2014 11:23 p.m., Jari Sollo wrote: > Hi ! > I understood that writing text to screen sould be quite simple, > apparentlynot to me. Iwrote small program and did not manage even with > it. Could somebody please tell me what is wrong/missing? > > Here is simple code: > > #include "Gra.ch" > #include "Xbp.ch" > #include "Appevent.ch" > #include "Font.ch" > #PRAGMA LIBRARY( "ASCOM10.LIB" ) > > PROCEDURE AppSys > RETURN //--------------------------------------- AppSys > -------------------------------------------------------------- > > PROCEDURE Main > LOCAL nEvent, mp1, mp2, aSize, oPS, aPS, oScreen > LOCAL oDlg, oXbp, drawingArea, aEditControls := {} > > > > oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) > oDlg:taskList := .T. > oDlg:title := "Test window" > oDlg:create() > aPS := {800,600} > oScreen := oDlg:windevice() > drawingArea := oDlg:drawingArea > drawingArea:setFontCompoundName( "8.Arial" ) > oPS := XbpPresSpace():new() > oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) > oDlg:show() > SetAppFocus(oDlg) > GraStringAt(oPS, {400,200}, "Testing...") > oPS:configure() > > nEvent := xbe_None > WHILE nEvent <> xbeP_Close > nEvent := AppEvent( @mp1, @mp2, @oXbp ) > oXbp:handleEvent( nEvent, mp1, mp2 ) > END > RETURN //------------------------------------ main > ------------------------------------- > | |
Philip G Jackson | Re: Graphic out put to screen on Tue, 04 Feb 2014 08:37:38 +1300 Hi Jari I would think you would need a Paint event to do this - this is a problem for a couple of my screens also as the graphic drawing is done once and not repeated so if the user goes to another screen and back, the graphic disappears. I vaguely remember something about Graphic Paths but not sure if this is relevant. Cheers Phil Jackson On 3/02/2014 11:09 p.m., Jari Sollo wrote: > Thanks everybody for helping me to get the picture. > The real missing points was: > > oScreen := drawingArea:windevice() > and: > oPS:configure(oScreen) > > with those lines it finally went ok. > > Is there a way to prevent graphic disappear while minimize and maximize > window? > > "Philip G Jackson" kirjoitti > viestissä:52074ca8$232a6434$4da@news.alaska-software.com... > > Hi Jari > > I use the following so that I can write fast screens using GRA methods > > oPS := XbpPresSpace():New() > oDevice := oDialog:DrawingArea:WinDevice() > oPS:CREATE(oDevice) > oPS:Mode := XBPPS_MODE_HIGH_PRECISION > GraSetColor(oPS,GRA_CLR_WHITE) > > oFont := xbpfont():NEw(oPS):CREATE('10.Arial Bold') > GraSetFont(oFont) > > display your text example > GraStringAt(oPS, {nColumn, nLine}, cTextToPrint) > > ... > > oPS:Destroy() > oFont:Destroy() > > I have two modes of drawing a small number of screens - objects and Gra > commands. GRA is somewhere between 10 and 20 times faster without > measuring it precisely. > > Hope that helps. > > Cheers > > Phil Jackson > > > On 29/01/2014 11:23 p.m., Jari Sollo wrote: >> Hi ! >> I understood that writing text to screen sould be quite simple, >> apparentlynot to me. Iwrote small program and did not manage even with >> it. Could somebody please tell me what is wrong/missing? >> >> Here is simple code: >> >> #include "Gra.ch" >> #include "Xbp.ch" >> #include "Appevent.ch" >> #include "Font.ch" >> #PRAGMA LIBRARY( "ASCOM10.LIB" ) >> >> PROCEDURE AppSys >> RETURN //--------------------------------------- AppSys >> -------------------------------------------------------------- >> >> PROCEDURE Main >> LOCAL nEvent, mp1, mp2, aSize, oPS, aPS, oScreen >> LOCAL oDlg, oXbp, drawingArea, aEditControls := {} >> >> >> >> oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) >> oDlg:taskList := .T. >> oDlg:title := "Test window" >> oDlg:create() >> aPS := {800,600} >> oScreen := oDlg:windevice() >> drawingArea := oDlg:drawingArea >> drawingArea:setFontCompoundName( "8.Arial" ) >> oPS := XbpPresSpace():new() >> oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) >> oDlg:show() >> SetAppFocus(oDlg) >> GraStringAt(oPS, {400,200}, "Testing...") >> oPS:configure() >> >> nEvent := xbe_None >> WHILE nEvent <> xbeP_Close >> nEvent := AppEvent( @mp1, @mp2, @oXbp ) >> oXbp:handleEvent( nEvent, mp1, mp2 ) >> END >> RETURN //------------------------------------ main >> ------------------------------------- >> > | |
Thomas Braun | Re: Graphic out put to screen on Tue, 04 Feb 2014 08:51:10 +0100 Philip G Jackson wrote: > I would think you would need a Paint event to do this The paint event causes this - or, to be more precise, the lack of a routine that reacts to the paint event and re-paints the canvas. Windows sends a paint event to any window that needs to be refreshed e.g. when it has been covered by another window or is re-sized. Relvant parts of the documentation are the xbpWindow class and the paint event (xbeP_Paint) or the paint slot/method respectively. > I vaguely remember something about Graphic Paths > but not sure if this is relevant. No, it isn't Thomas | |
James Loughner | Re: Graphic out put to screen on Mon, 03 Feb 2014 15:21:43 -0500 No you have to supply code to redraw on a paint event Jim On 02/03/2014 05:09 AM, Jari Sollo wrote: > Thanks everybody for helping me to get the picture. > The real missing points was: > > oScreen := drawingArea:windevice() > and: > oPS:configure(oScreen) > > with those lines it finally went ok. > > Is there a way to prevent graphic disappear while minimize and maximize > window? > > "Philip G Jackson" kirjoitti > viestissä:52074ca8$232a6434$4da@news.alaska-software.com... > > Hi Jari > > I use the following so that I can write fast screens using GRA methods > > oPS := XbpPresSpace():New() > oDevice := oDialog:DrawingArea:WinDevice() > oPS:CREATE(oDevice) > oPS:Mode := XBPPS_MODE_HIGH_PRECISION > GraSetColor(oPS,GRA_CLR_WHITE) > > oFont := xbpfont():NEw(oPS):CREATE('10.Arial Bold') > GraSetFont(oFont) > > display your text example > GraStringAt(oPS, {nColumn, nLine}, cTextToPrint) > > ... > > oPS:Destroy() > oFont:Destroy() > > I have two modes of drawing a small number of screens - objects and Gra > commands. GRA is somewhere between 10 and 20 times faster without > measuring it precisely. > > Hope that helps. > > Cheers > > Phil Jackson > > > On 29/01/2014 11:23 p.m., Jari Sollo wrote: >> Hi ! >> I understood that writing text to screen sould be quite simple, >> apparentlynot to me. Iwrote small program and did not manage even with >> it. Could somebody please tell me what is wrong/missing? >> >> Here is simple code: >> >> #include "Gra.ch" >> #include "Xbp.ch" >> #include "Appevent.ch" >> #include "Font.ch" >> #PRAGMA LIBRARY( "ASCOM10.LIB" ) >> >> PROCEDURE AppSys >> RETURN //--------------------------------------- AppSys >> -------------------------------------------------------------- >> >> PROCEDURE Main >> LOCAL nEvent, mp1, mp2, aSize, oPS, aPS, oScreen >> LOCAL oDlg, oXbp, drawingArea, aEditControls := {} >> >> >> >> oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) >> oDlg:taskList := .T. >> oDlg:title := "Test window" >> oDlg:create() >> aPS := {800,600} >> oScreen := oDlg:windevice() >> drawingArea := oDlg:drawingArea >> drawingArea:setFontCompoundName( "8.Arial" ) >> oPS := XbpPresSpace():new() >> oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) >> oDlg:show() >> SetAppFocus(oDlg) >> GraStringAt(oPS, {400,200}, "Testing...") >> oPS:configure() >> >> nEvent := xbe_None >> WHILE nEvent <> xbeP_Close >> nEvent := AppEvent( @mp1, @mp2, @oXbp ) >> oXbp:handleEvent( nEvent, mp1, mp2 ) >> END >> RETURN //------------------------------------ main >> ------------------------------------- >> > | |
Jari Sollo | Re: Graphic out put to screen on Wed, 19 Feb 2014 12:28:11 +0200 thank a bunch, pals! wery simply and easy now when know it. (It usually is), but I felt so lost at some time. I did somethin like this: (strongly simplified) oDlg:paint := {||GraSegDraw(oPS, aSegments[i])} "James Loughner" kirjoitti viestissä:1916f713$2c6c9741$115e7@news.alaska-software.com... No you have to supply code to redraw on a paint event Jim On 02/03/2014 05:09 AM, Jari Sollo wrote: > Thanks everybody for helping me to get the picture. > The real missing points was: > > oScreen := drawingArea:windevice() > and: > oPS:configure(oScreen) > > with those lines it finally went ok. > > Is there a way to prevent graphic disappear while minimize and maximize > window? > > "Philip G Jackson" kirjoitti > viestissä:52074ca8$232a6434$4da@news.alaska-software.com... > > Hi Jari > > I use the following so that I can write fast screens using GRA methods > > oPS := XbpPresSpace():New() > oDevice := oDialog:DrawingArea:WinDevice() > oPS:CREATE(oDevice) > oPS:Mode := XBPPS_MODE_HIGH_PRECISION > GraSetColor(oPS,GRA_CLR_WHITE) > > oFont := xbpfont():NEw(oPS):CREATE('10.Arial Bold') > GraSetFont(oFont) > > display your text example > GraStringAt(oPS, {nColumn, nLine}, cTextToPrint) > > ... > > oPS:Destroy() > oFont:Destroy() > > I have two modes of drawing a small number of screens - objects and Gra > commands. GRA is somewhere between 10 and 20 times faster without > measuring it precisely. > > Hope that helps. > > Cheers > > Phil Jackson > > > On 29/01/2014 11:23 p.m., Jari Sollo wrote: >> Hi ! >> I understood that writing text to screen sould be quite simple, >> apparentlynot to me. Iwrote small program and did not manage even with >> it. Could somebody please tell me what is wrong/missing? >> >> Here is simple code: >> >> #include "Gra.ch" >> #include "Xbp.ch" >> #include "Appevent.ch" >> #include "Font.ch" >> #PRAGMA LIBRARY( "ASCOM10.LIB" ) >> >> PROCEDURE AppSys >> RETURN //--------------------------------------- AppSys >> -------------------------------------------------------------- >> >> PROCEDURE Main >> LOCAL nEvent, mp1, mp2, aSize, oPS, aPS, oScreen >> LOCAL oDlg, oXbp, drawingArea, aEditControls := {} >> >> >> >> oDlg := XbpDialog():new( AppDesktop(), , {600,120}, {800,600}, , .F.) >> oDlg:taskList := .T. >> oDlg:title := "Test window" >> oDlg:create() >> aPS := {800,600} >> oScreen := oDlg:windevice() >> drawingArea := oDlg:drawingArea >> drawingArea:setFontCompoundName( "8.Arial" ) >> oPS := XbpPresSpace():new() >> oPS:create(oScreen, aPS, GRA_PU_LOMETRIC ) >> oDlg:show() >> SetAppFocus(oDlg) >> GraStringAt(oPS, {400,200}, "Testing...") >> oPS:configure() >> >> nEvent := xbe_None >> WHILE nEvent <> xbeP_Close >> nEvent := AppEvent( @mp1, @mp2, @oXbp ) >> oXbp:handleEvent( nEvent, mp1, mp2 ) >> END >> RETURN //------------------------------------ main >> ------------------------------------- >> > |