How to use a bitmap instead of tsbutton

How to use a bitmap instead of tsbutton

Postby Silvio » Thu Jun 18, 2009 1:49 pm

I made my application with tsbutton but it seem tsbutton have problems ( changebitmaps method not run well)

How I can simulate a button with a bitmap ?

and from this bitmap must open a menu popup with options

and how change the bitmap with another bitmap if this bitmap have a value on the cargo ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: How to use a bitmap instead of tsbutton

Postby James Bott » Thu Jun 18, 2009 11:56 pm

Code: Select all  Expand view
// Example of clickable bitmap

#include "fivewin.ch"

function main()
   local oWnd, oBmp

   define window oWnd title "Test Mouse Over"

   @ 4, 16 BITMAP oBmp FILENAME "Tutanka1.bmp" ADJUST SIZE 280, 200 OF oWnd

   oBmp:bLClicked := {|| Msgalert( "Button" ) }

   oBmp:bMMoved := { || cursorhand() }

   activate window oWnd

return nil
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: How to use a bitmap instead of tsbutton

Postby Silvio » Fri Jun 19, 2009 11:41 am

because I want try to see How Many control a dialog support
On a dialog style nor 4 I can insert a config max 15X100=1500 controls
Now I use sbutton but perhaps I can make to another mode ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: How to use a bitmap instead of tsbutton

Postby James Bott » Fri Jun 19, 2009 4:40 pm

If you need to use 1500 or more controls then I think you need to rethink your design. Users don't want to look at 1500 controls, then need to see just the ones that are important to them--perhaps in this case only umbrellas that can be reserved.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: How to use a bitmap instead of tsbutton

Postby Silvio » Fri Jun 19, 2009 4:57 pm

the user want see until 5000 umbrellas
How I can make ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: How to use a bitmap instead of tsbutton

Postby James Bott » Fri Jun 19, 2009 5:12 pm

>the user want see until 5000 umbrellas
>How I can make ?

My point is that no user wants to see 5000 umbrellas. They want to see only the information they need to accomplish their task. If there really are 5000 available umbrellas, then they only need to see the best choices in order of whatever criteria makes them the best choice.

For example, if you want to buy a new television, you don't want to look at every TV on the market, you just want to look at the ones that meet your criteria (maybe LCD's larger than 46 inches with built-in speakers, that cost less than 1000 Euros). That really narrows down what you have to look at and you might want to see them in order of lower price to higher.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: How to use a bitmap instead of tsbutton

Postby Otto » Fri Jun 19, 2009 6:23 pm

Hello Silvio,
in this screen shot I show 77*70 = more than 5000 small boxes.
On a 22” monitor this resolution is ok.
I think you should use your TPlan Class for this task.
Best regards,
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to use a bitmap instead of tsbutton

Postby Silvio » Sat Jun 20, 2009 7:27 pm

Otto,
yes I can use my tplan for it but there is a problem YOU not thinked...
But my friend have the sea chalet wants see the umbrellas to different configuration.
I cannot show only the umbrellas made in a row or in a column
I must show also the umbrellas made in a circular, semicircular, corrugated, and diagonally
Image
As you can see in this picture there are different configuration and then I must show house, and other object into this dialog: it is not easy...
the Tableay can be use but only to create booking orders...
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: How to use a bitmap instead of tsbutton

Postby Silvio » Sat Jun 20, 2009 7:33 pm

Otto ,
I made a test...
I can show 5000 umbrellas on a window but not in a dialog
Code: Select all  Expand view


// Example of clickable bitmap

#include "fivewin.ch"
Static oScrWnd

function main()
   local oWnd, oBmp
   Local nRow:=0, ncol:=0 ,  k:=0
   Local   abtn[5000]

 *  define window oWnd title "Test Mouse Over"

 DEFINE DIALOG oDLG

   for n=1 to 5000

   @ nRow, ncol BITMAP abtn[n] FILENAME "verde.bmp" ADJUST SIZE 40,40 OF oDLG  NOBORDER

   abtn[n]:bLClicked := {|| Menu_azioni(obmp) }

   abtn[n]:bMMoved := { || cursorhand() }

   aBtn[n]:cargo := { 'Prenotato', n,   }


   ncol:=  ncol +5
     k:=k+1
   if k=100
      nrow:= nrow +2.5
      k:=0
       ncol:=0
   endif

    next n

    * activate window oWnd  ;
    ACTIVATE DIALOG oDLG   ;
       ON INIT  oScrWnd:=TScrWnd():New(oDLG,1,1000,1,100+850)

   return nil




   function Menu_azioni( obmp)
   Local oMenu, aRect ,nRow,nCol
   lOCAL ncame := obmp:cargo[2]
     aRect := GetClientRect( obmp:hWnd )
    MENU oMenu POPUP   2007
    MENU
     MENUITEM "Ombrellone n. "+str(obmp:Cargo[2])
     MENUITEM "&Vedi Prenotazioni"
            ENDMENU
   ACTIVATE POPUP oMenu AT aRect[ 3 ] + 1, aRect[ 2 ] OF  oBtn
   RETURN NIL





on a dialog it crash ... why ???

instead on a window it run ok


then the bitmap not have cargo command .... I cannot create it as sbutton
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: How to use a bitmap instead of tsbutton

Postby Otto » Sun Jun 21, 2009 8:23 am

Hello Silvio,
As you can see in this picture there are different configuration and then I must show house, and other object into this dialog: it is not easy...
the Tableay can be use but only to create booking orders...


I tried with bitmaps.
Here is the demo-exe:
Regards,
Otto
http://www.atzwanger-software.com/fw/silviosbeach.zip

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to use a bitmap instead of tsbutton

Postby Silvio » Sun Jun 21, 2009 8:56 am

good!!
why not pubblish the source here ?

this is a window ...
have you tried on a dialog ?
with ::nStyle = nOR( WS_CHILD, 4 )
I need a config x = 100 y = 50
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: How to use a bitmap instead of tsbutton

Postby Otto » Sun Jun 21, 2009 9:15 am

Silvio,
please post your code how you define the dialog
Otto
Code: Select all  Expand view

    DEFINE DIALOG oDlg   FROM 0, 0 TO 50,100
   
   
    ACTIVATE DIALOG oDlg  

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to use a bitmap instead of tsbutton

Postby Silvio » Sun Jun 21, 2009 9:33 am

FIRST SIMPLY WINDOW MAIN

STATIC oWndMain,oScrWnd
FUNCTION MAIN()

DEFINE WINDOW oWndMain ;
TITLE "BEACH";
MENU BuildMenu() ;
ICON oIcon

DEFINE BUTTONBAR oBar _3D SIZE 42, 50 OF oWndMain 2007 //36, 40

DEFINE BUTTON OF oBar ;
ACTION BEACH() NOBORDER


ACTIVATE WINDOW oWndMain
RETURN NIL



FUNCTION BEACH
Local oDlg
Local aClient := GetClientRect (oWndMain:hWnd )

DEFINE DIALOG oDlg

oDlg:nTop = oWndMain:oBar:nHeight-1
oDlg:nLeft = 0
oDlg:nBottom = aClient[3] - 1
oDlg:nRight = aClient[4]
oDlg:nStyle = nOR( WS_CHILD, 4 )
oDlg:nStyle:= NOR( oApp():oDlg:nStyle, WS_VSCROLL )
oDlg:nStyle:= NOR( oApp():oDlg:nStyle, WS_HSCROLL )
oDlg:SetColor(0,RGB(143,172,230))
oWndMain:oClient := oDlg



ACTIVATE DIALOG oDlg ;
ON INIT oScrWnd:=TScrWnd():New(oDlg,1,900,1,100+950)
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: How to use a bitmap instead of tsbutton

Postby Otto » Sun Jun 21, 2009 12:06 pm

Silvio, I am sorry but I can’t test with your code. There are some functions missing:
oApp(),TScrWnd(),BuildMenu(),oIcon


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to use a bitmap instead of tsbutton

Postby Otto » Sun Jun 21, 2009 3:38 pm

Hello Silvio,
now I had an idea how to get all the information one needs into the beach table:
you could print as an extra the vacancies on the “umbrella”-bitmaps - meaning this is free for 1-n days.
Regards,
Otto
PS: this is a dialog
Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 115 guests