Page 1 of 4
bitmap resource
Posted: Wed Sep 17, 2014 2:00 pm
by bwolfsohn
Roger,
Way back in the last century, we (you & i) included this code in our main system menu..
DCGETOPTIONS WINDOWWIDTH nWidth ;
WINDOWHEIGHT nHeight ;
WINDOWROW nStartRow ;
WINDOWCOL nStartCol ;
AUTOWINDOWMENU ;
BITMAP IIF( STA_COOLSCRN,CUS_BITMAP_LOGO_BACKGROUND,nil ) ;
COLOR {160,160,160} ;
TOOLTIPCOLOR GRA_CLR_BLACK, GRA_CLR_YELLOW ;
ABORTQUERY MSG {||isbyebye()} ;
CLOSEQUERY MSG {||isbyebye()} ;
EVAL {|o|oTimer:=DC_SetTimerEvent():new(100,{||_UpdateStats(GetList)},SetAppWindow(o)) } ;
HELPCODE 'DESKTOP.AUCTION'
the bitmap was compiled into a .res file via an .arc file.
questions:
1. Is this still the most efficient way to do this ?
2. is there a newer alternative for a main window background ?
3. Is it possible to change the bitmap during program execution ?
thanks..
Re: bitmap resource
Posted: Thu Sep 18, 2014 1:50 am
by Tom
Hi, Brian.
I removed the "BITMAP" clause from my main menu options and added this code right behind "DCGET OPTIONS":
Code: Select all
IF !Empty(cMyMainMenuBitmap) .and. File(cMyMainMenuBitmap) // "cMyMainMenuBitmap" may be something like "c:\images\pict999.jpg"
GetOptions[nGETOPT_BITMAP] := DC_GetBitmap(cMyMainMenuBitmap)
ELSE
GetOptions[nGETOPT_BITMAP] := BITMAP_FROM_RESSOURCE
ENDIF
Re: bitmap resource
Posted: Thu Sep 18, 2014 6:39 am
by bwolfsohn
Tom,
thanks, i think i'll try that...
But, can GetOptions[nGETOPT_BITMAP] be changed during the program and will it redisplay ?
If not, are there other approaches ?
Re: bitmap resource
Posted: Thu Sep 18, 2014 7:31 am
by rdonnay
Here is how Bobby Drakos changes the background in his Medalion program during the day.
He has a timer that loads a different bitmap to show the color of the sky at different times of the day.
Code: Select all
oDlg:drawingArea:bitmap := DC_GetBitmap(cBitmap)
oDlg:lockUpdate(.T.)
oDlg:configure()
oDlg:LockUpdate(.F.)
Re: bitmap resource
Posted: Thu Sep 18, 2014 7:39 am
by bwolfsohn
thanks.. perfect.. that's what i'm looking for...
Re: bitmap resource
Posted: Thu Sep 18, 2014 8:46 pm
by Eugene Lutsenko
rdonnay wrote:Here is how Bobby Drakos changes the background in his Medalion program during the day.
He has a timer that loads a different bitmap to show the color of the sky at different times of the day.
Code: Select all
oDlg:drawingArea:bitmap := DC_GetBitmap(cBitmap)
oDlg:lockUpdate(.T.)
oDlg:configure()
oDlg:LockUpdate(.F.)
Is it possible to bring something like a small working demo program with source code as xdemo.exe? I got interested in these opportunities.
Re: bitmap resource
Posted: Sun Sep 21, 2014 10:47 am
by rdonnay
Is it possible to bring something like a small working demo program with source code as xdemo.exe? I got interested in these opportunities.
Here it is (attached)
Code: Select all
#INCLUDE "dcdialog.CH"
LOCAL GetList[0], GetOptions, oTimer, oDlg, aBitmaps
aBitmaps := Directory('mwb1024*.bmp')
DCGETOPTIONS ;
WINDOWWIDTH 1024 ;
WINDOWHEIGHT 800
oTimer := DC_SetTimerEvent():new(200,{||ChangeBackground(@oDlg,aBitmaps)})
DCREAD GUI TITLE 'Rotating Bitmap Backgrounds' PARENT @oDlg ;
OPTIONS GetOptions
oTimer:destroy()
RETURN nil
* -----------
PROC appsys ; RETURN
* -----------
STATIC FUNCTION ChangeBackground( oDlg, aBitmaps )
LOCAL oBitmap
STATIC snPointer := 0
snPointer++
IF oDlg == nil .OR. oDlg:status() = 0 .OR. Len(aBitmaps) = 0
RETURN nil
ENDIF
IF snPointer > Len(aBitmaps)
snPointer := 1
ENDIF
oBitmap := DC_GetBitmap(aBitmaps[snPointer,1])
oDlg:lockUpdate(.t.)
oDlg:drawingArea:bitmap := oBitmap
oDlg:configure()
oDlg:lockUpdate(.f.)
RETURN nil
Re: bitmap resource
Posted: Sun Sep 21, 2014 1:20 pm
by Eugene Lutsenko
Very nicely done. Just a HUGE thank you! Be sure I will enjoy!
Re: bitmap resource
Posted: Mon Sep 22, 2014 9:23 am
by Eugene Lutsenko
oTimer := DC_SetTimerEvent():new(200,{||ChangeBackground(@oDlgBmp,aBitmaps,"ЧЧ")})
Can I do to change the image is not initiated after a while, and on a specific event, such as when there is a change hours
Yet for some reason when you change the image disappears open window mode, and the menu is still displayed normal.
How to make the background appear just outside the window, and not painted all over it?
How to make the main window always remained in the background and does not overlap the new window when it is updated background?
Re: bitmap resource
Posted: Wed Sep 24, 2014 1:09 pm
by Eugene Lutsenko
Can I do to change the image is not initiated after a while, and on a specific event, such as when there is a change hours
Yet for some reason when you change the image disappears open window mode, and the menu is still displayed normal.
How to make the background appear just outside the window, and not painted all over it?
How to make the main window always remained in the background and does not overlap the new window when it is updated background?