Mawdraw problem (easyptr4)

Anything QL Software or Programming Related.
User avatar
Giorgio Garabello
Trump Card
Posts: 207
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

Mawdraw problem (easyptr4)

Postby Giorgio Garabello » Sat Apr 14, 2018 6:53 am

Hi, do you think it is possible to format a single item of an application window menu so that it always appears as a single element but divided into two lines? I tried to insert chr $ (10) inside an element of an arrray like this: a $ (0) = "Hi" & chr $ (10) & "For" but it does not work, only "Hi" is displayed .

Regards
Giorgio


User avatar
Giorgio Garabello
Trump Card
Posts: 207
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

Re: Mawdraw problem (easyptr4)

Postby Giorgio Garabello » Sat Apr 14, 2018 6:55 am

Giorgio Garabello wrote:Hi, do you think it is possible to format a single item of an application window menu so that it always appears as a single element but divided into two lines? I tried to insert chr $ (10) inside an element of an arrray like this: a $ (0) = "Hi" & chr $ (10) & "John" but it does not work, only "Hi" is displayed .

Regards
Giorgio


User avatar
tofro
QL Wafer Drive
Posts: 1378
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Mawdraw problem (easyptr4)

Postby tofro » Sat Apr 14, 2018 7:12 am

Giorgio,

the simplest way to achieve that is to create a bitmap of that two lines of text and put the bitmap in the menu.

There are probably better ways to do that, though.

Tobias


User avatar
Giorgio Garabello
Trump Card
Posts: 207
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

Re: Mawdraw problem (easyptr4)

Postby Giorgio Garabello » Sat Apr 14, 2018 7:30 am

tofro wrote:Giorgio,

the simplest way to achieve that is to create a bitmap of that two lines of text and put the bitmap in the menu.

There are probably better ways to do that, though.

Tobias

the problem is that is not a fixed text but came frim a file, it change every time.


User avatar
Giorgio Garabello
Trump Card
Posts: 207
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

Re: Mawdraw problem (easyptr4)

Postby Giorgio Garabello » Sat Apr 14, 2018 8:31 am

Giorgio Garabello wrote:Hi, do you think it is possible to format a single item of an application window menu so that it always appears as a single element but divided into two lines? I tried to insert chr $ (10) inside an element of an arrray like this: a $ (0) = "Hi" & chr $ (10) & "John" but it does not work, only "Hi" is displayed .

Regards
Giorgio


User avatar
pjw
Gold Card
Posts: 383
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: Mawdraw problem (easyptr4)

Postby pjw » Sat Apr 14, 2018 9:35 am

Giorgio Garabello wrote:Hi, do you think it is possible to format a single item of an application window menu so that it always appears as a single element but divided into two lines? I tried to insert chr $ (10) inside an element of an arrray like this: a $ (0) = "Hi" & chr $ (10) & "For" but it does not work, only "Hi" is displayed .
I havent tried this, but you could try making the element box the size you want (MAWDRAW#ch,,,,,xsz%, ysz%) then, using MWINDOW, print the lines into the box.
Still, the most flexible method, to my mind would be my third suggestion of last night: Once you have your menu window up and running, with a suitable Application window inside, bypass Wman and fake the usual Wman interaction using only PI. To make the routine fast and smoothe, dont bother faking the selection outline, but use highlighting instead. BYpassing Wman constraints in this way opens the door many other interesting effects which are currently impossible under Wman.


Per
For every complex problem there is an answer that is clear, simple, and wrong.
- H. L. Mencken
User avatar
Giorgio Garabello
Trump Card
Posts: 207
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

Re: Mawdraw problem (easyptr4)

Postby Giorgio Garabello » Sat Apr 14, 2018 5:22 pm

I've just tried but seems dont work
MWINDOW #3,65537
Print #3, "hallo" dont print in the furst menu element but in the cirner of the MAW


User avatar
BSJR
Chuggy Microdrive
Posts: 52
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: Mawdraw problem (easyptr4)

Postby BSJR » Sun Apr 15, 2018 1:25 pm

Giorgio Garabello wrote:I've just tried but seems dont work
MWINDOW #3,65537
Print #3, "hallo" dont print in the furst menu element but in the cirner of the MAW

Are you sure?
In my test I did the same, the string was nicely printed in each of the 4 menu items when hit:
:
rep loop
num= mcall (#c3%,0): awn= 65536
select on num
= -1 : stop : rem >>> esc
= -3 : mawdraw #c3%\1 : rem >>> wake, restores original aw$
=awn +1 : mwindow #c3%,awn +1: print #c3%;aw$(0,0)
=awn *2 +1 : mwindow #c3%,awn *2 +1: print #c3%;aw$(0,1)
=awn *3 +1 : mwindow #c3%,awn *3 +1: print #c3%;aw$(1,0)
=awn *4 +1 : mwindow #c3%,awn *4 +1: print #c3%;aw$(1,1)
end select
end rep
:
aw$ is the original array for MAWSETUP, containing a LF between two strings.
MAWDRAW and MAWITEM will only show the first part but PRINT will use the LF to move to the next line.
Remember that the y-size of each cell must be enough to hold the lines.
Also any justification used in MAWDRAW will have no effect after MWINDOW and may need to be fixed with AT or CURSOR commands.

You could use a loop to go through all visible aw$ items to check if any LF is there and then do a MWINDOW/PRINT to replace that cell. However depending on the number of visible cells this may be a slow process.
Beware that if the string before the LF is too long for the cell width, the rest will move one line down too.

Bob


User avatar
Giorgio Garabello
Trump Card
Posts: 207
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

Re: Mawdraw problem (easyptr4)

Postby Giorgio Garabello » Sun Apr 15, 2018 1:39 pm

BSJR wrote:
Giorgio Garabello wrote:I've just tried but seems dont work
MWINDOW #3,65537
Print #3, "hallo" dont print in the furst menu element but in the cirner of the MAW

Are you sure?
In my test I did the same, the string was nicely printed in each of the 4 menu items when hit:
:
rep loop
num= mcall (#c3%,0): awn= 65536
select on num
= -1 : stop : rem >>> esc
= -3 : mawdraw #c3%\1 : rem >>> wake, restores original aw$
=awn +1 : mwindow #c3%,awn +1: print #c3%;aw$(0,0)
=awn *2 +1 : mwindow #c3%,awn *2 +1: print #c3%;aw$(0,1)
=awn *3 +1 : mwindow #c3%,awn *3 +1: print #c3%;aw$(1,0)
=awn *4 +1 : mwindow #c3%,awn *4 +1: print #c3%;aw$(1,1)
end select
end rep
:
aw$ is the original array for MAWSETUP, containing a LF between two strings.
MAWDRAW and MAWITEM will only show the first part but PRINT will use the LF to move to the next line.
Remember that the y-size of each cell must be enough to hold the lines.
Also any justification used in MAWDRAW will have no effect after MWINDOW and may need to be fixed with AT or CURSOR commands.

You could use a loop to go through all visible aw$ items to check if any LF is there and then do a MWINDOW/PRINT to replace that cell. However depending on the number of visible cells this may be a slow process.
Beware that if the string before the LF is too long for the cell width, the rest will move one line down too.

Bob

I'm trying to do something different, you print the string after clicking, I need to present a list in which each element is divided into several lines, to scroll through this list and eventually select an element

Giorgio


User avatar
BSJR
Chuggy Microdrive
Posts: 52
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: Mawdraw problem (easyptr4)

Postby BSJR » Sun Apr 15, 2018 2:14 pm

I'm trying to do something different, you print the string after clicking, I need to present a list in which each element is divided into several lines, to scroll through this list and eventually select an element

Giorgio

This is just a proof of concept. I have not tested what happens when a list needs to scroll up or down.
If it's a single column list you want, you could adopt what I do in SuQcess with Viewing a record with subfields.
The list can be scrolled (set the main window to a minimum) and each line is a field or a subfield and can be clicked on.
In a separate array I keep track of which field that line belongs to so the correct field is taken to act upon.

Bob



Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 3 guests