Create solid color bitmap array

Create solid color bitmap array

Postby TimStone » Tue Jul 11, 2023 4:40 am

I am using a combobox ( REDEFINE in an RC file ). The dropdown is an array of color bitmaps.

Code: Select all  Expand view  RUN

 REDEFINE COMBOBOX oCB2 VAR oAppointmentr:AptClr ;
      ID 4065 OF oCalDlg ;
       ITEMS { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" } ;
       BITMAPS { "CJ00", "CJ01","CJ02", "CJ03", "CJ04", "CJ05", "CJ06", "CJ07", ;
       "CJ08","CJ09", "CJ10" } ;
        MESSAGE "Enter the technician, or service area, for this appointment"
 


It works, but the colors are not exactly what I want. I have the exact RGB values for the ones I want.

Does FWH have the ability to build an array of colors ( instead of bitmaps ) that would use the RGB values I want ? I can't just change the background of the control because I need to show the array values in the dropdown.

If not, can someone suggest a BMP editor that will allow me to simply change the existing color to the value I need. I have a few tools but none of them want to cooperate.

Thank you.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Create solid color bitmap array

Postby Marc Venken » Tue Jul 11, 2023 7:48 am

Maybe some info here :

https://forums.fivetechsupport.com/viewtopic.php?f=3&t=35303&start=15&sid=d1d0a1cdae4ec50d908abf9ebf16bc11

Maybe a Small Xbrowse instead of combo ?

https://forums.fivetechsupport.com/viewtopic.php?f=3&t=38071#p227515

I use Colorpicker for most off my projects, because if shows all different values.

Image
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1446
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Create solid color bitmap array

Postby nageswaragunupudi » Tue Jul 11, 2023 10:10 am

If not, can someone suggest a BMP editor that will allow me to simply change the existing color to the value I need. I have a few tools but none of them want to cooperate.


FWH provides the best tool, i.e., the function FW_MakeYourBitmap(...)

Code: Select all  Expand view  RUN
function ColorBmps()

   local aColors  := { CLR_HRED, CLR_HGREEN, CLR_HBLUE }
   local aBitmaps := Array( Len( aColors ) )
   local nSize    := 24
   local n

   for n := 1 to Len( aColors )
      aBitmaps[ n ] := FW_MakeYourBitmap( nSize, nSize, <|hDC,w,h|
         FW_Box( hDC, {0,0,h,w}, CLR_BLACK, aColors[ n ] )
         return nil
         > )
   next

   XBROWSER aBitmaps SETUP oBrw:aCols[ 1 ]:cDataType := "P"

return aBitmaps

 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10656
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Create solid color bitmap array

Postby nageswaragunupudi » Tue Jul 11, 2023 11:04 am

ComboBox

Code: Select all  Expand view  RUN
function ColorCbx()

   local oDlg, oCbx
   local nVar     := 1
   local aPrompts := { "RED", "GEEN", "BLUE" }
   local aColors  := { CLR_HRED, CLR_HGREEN, CLR_HBLUE }
   local aBitmaps := ColorBmps( aColors, 24 )

   DEFINE DIALOG oDlg SIZE 300,300 PIXEL TRUEPIXEL

   @ 20,20 COMBOBOX oCbx VAR nVar SIZE 200,200 PIXEL OF oDlg ;
      ITEMS aPrompts BITMAPS aBitmaps

   ACTIVATE DIALOG oDlg CENTERED

return nil

function ColorBmps( aColors, nSize )

   local aBitmaps, n

   DEFAULT aColors   := { CLR_HRED, CLR_HGREEN, CLR_HBLUE }
   DEFAULT nSize     := 24
   aBitmaps := Array( Len( aColors ) )

   for n := 1 to Len( aColors )
      aBitmaps[ n ] := FW_MakeYourBitmap( nSize, nSize, <|hDC,w,h|
         FW_Box( hDC, {0,0,h,w}, CLR_BLACK, aColors[ n ] )
         return nil
         > )
   next

return aBitmaps
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10656
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Create solid color bitmap array

Postby TimStone » Wed Jul 12, 2023 6:15 pm

Thank you. The FWH function worked perfectly. Unfortunately it didn't solve my problem, but that is a Codejock issue, not FW, and I will find a solution. ( Their documentation differs from what actually occurs ... ). However, what you provided is perfect.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Create solid color bitmap array

Postby nageswaragunupudi » Thu Jul 13, 2023 1:27 am

but that is a Codejock issue, not FW,

What do you want to solve Codejock issue?
Do you want solid color bitmaps saved on disk?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10656
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Create solid color bitmap array

Postby TimStone » Thu Jul 13, 2023 1:51 am

Many years back, several of us worked to build an integration for Codeblock Calendar into FWH. You will find it in the samples directory of the FWH distributions.

In one of my added functions, I can select a color to designate who will be performing the work ( or any other user defined purpose ). The color is associated with an ID

One attribute you can define is the Label for the particular appointment event, and the ID determines the background color for that appointment entry. The label is a numeric value that you specify. Codejock has a list of default colors, their RGB values, and the ID code used.

On the dropdown I select a color, and store the code value to the record for that event ( appointment ). Then when displaying the full calendar, it is to display in the selected color.

I had color mismatches and assumed it was because my bmp files used for each code were wrong. So I used the function you suggested, and I can see that each value is perfectly correct. Since the menu also shows the ID, I know I have a 100% match between the default, internal, color list and my bitmaps.

The problem is when the even displays on the main calendar, it shows an incorrect color. It is a different one than what I have selected.

Thus, I can only conclude that the chart inside of Codejock, with its defaults, does not match the IDs that are described in the documentation help file.

That is why it is a Codejock issue. What you gave me works perfectly. I can likely do a work around by finding the current id values through testing, and then making my bitmaps use those. It's just annoying !

Your solution was perfect. I just need to now match up the colors with their current values.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 21 guests