bitmap resource

This forum is for eXpress++ general support.
Message
Author
bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

bitmap resource

#1 Post 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..
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
Tom
Posts: 1234
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: bitmap resource

#2 Post 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
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: bitmap resource

#3 Post 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 ?
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: bitmap resource

#4 Post 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.)
The eXpress train is coming - and it has more cars.

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: bitmap resource

#5 Post by bwolfsohn »

thanks.. perfect.. that's what i'm looking for...
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: bitmap resource

#6 Post 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.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: bitmap resource

#7 Post 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
Attachments
background.zip
(1.79 MiB) Downloaded 654 times
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: bitmap resource

#8 Post by Eugene Lutsenko »

Very nicely done. Just a HUGE thank you! Be sure I will enjoy!

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: bitmap resource

#9 Post 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?

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: bitmap resource

#10 Post 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?

Post Reply