bitmap resource

This forum is for eXpress++ general support.
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: bitmap resource

#11 Post by rdonnay »

Yet for some reason when you change the image disappears open window mode, and the menu is still displayed normal.
I don't understand this. Please clarify what you are saying.
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

#12 Post by Eugene Lutsenko »

Hi, Roger! I am grateful to you that you responded.

It seems everything has turned out as I wanted

Code: Select all

STATIC FUNCTION ChangeBackground( oDlgBmp, aBitmaps )

LOCAL oBitmap

STATIC snPointer := 0

*MsgBox(TIME())

HH = VAL(SUBSTR(TIME(),1,2))            // Часы
MM = VAL(SUBSTR(TIME(),4,2))            // Минуты
SS = VAL(SUBSTR(TIME(),7,2))            // Секунды

mTime = HH*3600 + MM*60 + SS            // Время, прошедшее с начала суток в секундах
D = 86400 / LEN( aBitmaps )             // Величина интервала имен фонов с одинаковым индексом
snPointer = 1 + INT( (mTime-1) / D )        // Индекс отображаемого фона

** Исключить недопустимые значения номера изображения

IF snPointer = 0 .OR. snPointer > Len(aBitmaps)
  snPointer := 1
ENDIF

   *** Проверять демонстрируемое изображение фона на совпадение контрольной суммы, 
   *** чтобы его невозможно было заменить использовать массив контрольных сумм/
   *** Массив контрольных сумм формировать и записывать после формирования и записи фонов.

   IF FILE("_CheckSum.arx")

      aCheckSum = DC_ARestore("_CheckSum.arx")
*     DC_ASave(aCheckSum, "_CheckSum.arx")

      IF aCheckSum[snPointer] = FILECHECK(Disk_dir+'\Aid_data\BackGround\'+aBitmaps[snPointer,1])

         IF oDlgBmp == nil .OR. oDlgBmp:status() = 0 .OR. Len(aBitmaps) = 0
            RETURN nil
         ENDIF

         oBitmap := DC_GetBitmap(Disk_dir+'\Aid_data\BackGround\'+aBitmaps[snPointer,1])

         oDlgBmp:lockUpdate(.t.)
         oDlgBmp:drawingArea:bitmap := oBitmap
         oDlgBmp:configure()
         oDlgBmp:lockUpdate(.f.)

      ENDIF
   ENDIF

RETURN nil
[/size]

And what does this status mean?

Code: Select all

oDlgBmp:status() = 0
Sometimes there is an error:
Image
in the line:

Code: Select all

IF oDlgBmp == nil .OR. oDlgBmp:status() = 0 .OR. Len(aBitmaps) = 0
One gets the impression that the file is in use, like hooya should already be available for use
Last edited by Eugene Lutsenko on Wed Oct 01, 2014 5:51 am, edited 1 time in total.

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

Re: bitmap resource

#13 Post by rdonnay »

Eugene -

See below for a description of the :status() method.
I don't know why this is happening but apparently the oDlgBmp variable is not an object when this test occurs, probably due to a racing condition between threads. I recommend calling DC_SetTimerEvent() in the EVAL codeblock of DCREAD GUI to insure that the timer thread does not start until the dialog is fully created.

Code: Select all

DCREAD GUI ... EVAL {|o|oTimer := DC_SetTimerEvent(100,{||ChangeBackground(o,aBitmaps)})}
You can then change this:

Code: Select all

 IF oDlgBmp == nil .OR. oDlgBmp:status() = 0 .OR. Len(aBitmaps) = 0
to this:

Code: Select all

  IF Len(aBitmaps) = 0
Class

XbpPartHandler()

Syntax

:status() --> nStatus

Return

This method returns a numeric value indicating the current status of an Xbase Part. Possible return values correspond with #define constants listed in the XBP.CH file. The following values can be returned:

Return values of oXbp:status()

Constant Description

XBP_STAT_INIT Xbase Part object is initialized
XBP_STAT_CREATE The :create() method was called successfully
XBP_STAT_FAILURE The :create() method failed to obtain system resources

Description

Xbase Part objects can exist in different states during their "life cycle", depending on the methods :create() and :destroy() . The method :status() is used to determine the current status of an Xbase Part.
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

#14 Post by Eugene Lutsenko »

Thank you, Roger!

Now clearly always works:

Code: Select all

IF Len(aBitmaps) = 0
Here's what happened (see 1.8 mode):

https://translate.google.com/translate? ... edit-text=

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

#15 Post by Eugene Lutsenko »

How do I make the background is updated, previously open windows do not fall into the background and do not become invisible in the background, and remained in the foreground? Some of the windows are (eg 2.1), and some are lost (eg 1.3, 6.4), but the difference between them in a software implementation, which could affect it, I have not found

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

Re: bitmap resource

#16 Post by rdonnay »

Try this:

Code: Select all

oDlg:drawingArea:bitmap := oBitmap
oDlg:drawingArea:sizeRedraw := .t.
oDlg:drawingArea:setSize(oDlg:drawingArea:currentSize())
oDlg:drawingArea:configure()
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

#17 Post by Eugene Lutsenko »

Thank you, Roger!

Everything was working fine as I wanted! Of course before this I would never have thought of.

If quick launch system, an error occurs:
Image
This is a string:

Code: Select all

oDlgBmp:drawingArea:bitmap := oBitmap
Is it possible to make the wait status of the desired object in the program display the background?
Another reason was the background update only after you restart the program.

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

Re: bitmap resource

#18 Post by rdonnay »

I do not understand.

I will need a small sample program.
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

#19 Post by Eugene Lutsenko »

rdonnay wrote:I do not understand.

I will need a small sample program.
And let me show system, because to pick out a small portion of hard. There and the menu, and the ways and windows, etc. I'll just say what to call involved in this issue feature. They are easy to find by name and they are in the original text are close by.

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

Re: bitmap resource

#20 Post by rdonnay »

Then simply show me the code that calls DC_SetTimerEvent() and the function that it calls.
The eXpress train is coming - and it has more cars.

Post Reply